notionary 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- notionary/elements/registry/block_registry_builder.py +1 -1
- notionary/models/notion_database_response.py +1 -2
- notionary/notion_client.py +0 -2
- notionary/prompting/markdown_syntax_prompt_generator.py +40 -21
- {notionary-0.2.2.dist-info → notionary-0.2.4.dist-info}/METADATA +1 -1
- {notionary-0.2.2.dist-info → notionary-0.2.4.dist-info}/RECORD +9 -9
- {notionary-0.2.2.dist-info → notionary-0.2.4.dist-info}/WHEEL +0 -0
- {notionary-0.2.2.dist-info → notionary-0.2.4.dist-info}/licenses/LICENSE +0 -0
- {notionary-0.2.2.dist-info → notionary-0.2.4.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
from pydantic import BaseModel
|
3
2
|
from dataclasses import dataclass
|
4
3
|
from typing import Optional, List, Dict, Any, Literal
|
@@ -55,4 +54,4 @@ class NotionDatabaseResponse(BaseModel):
|
|
55
54
|
public_url: Optional[str]
|
56
55
|
archived: bool
|
57
56
|
in_trash: bool
|
58
|
-
request_id: Optional[str] = None
|
57
|
+
request_id: Optional[str] = None
|
notionary/notion_client.py
CHANGED
@@ -69,8 +69,6 @@ class NotionClient(LoggingMixin):
|
|
69
69
|
"""
|
70
70
|
return await self._make_request(HttpMethod.GET, endpoint)
|
71
71
|
|
72
|
-
# TODO: Get Blocks implementeren und Patch Blcoks hierfür das Typing finden:
|
73
|
-
|
74
72
|
async def get_database(self, database_id: str) -> NotionDatabaseResponse:
|
75
73
|
"""
|
76
74
|
Ruft die Metadaten einer Notion-Datenbank anhand ihrer ID ab und gibt sie als NotionPageResponse zurück.
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
from pathlib import Path
|
1
|
+
from textwrap import dedent
|
3
2
|
from typing import Type, List
|
4
3
|
from notionary.elements.notion_block_element import NotionBlockElement
|
5
4
|
|
@@ -12,24 +11,46 @@ class MarkdownSyntaxPromptGenerator:
|
|
12
11
|
and formats them optimally for LLMs.
|
13
12
|
"""
|
14
13
|
|
15
|
-
|
16
|
-
# Lade das Template aus der Markdown-Datei
|
17
|
-
self.SYSTEM_PROMPT_TEMPLATE = self._load_template()
|
18
|
-
|
19
|
-
def _load_template(self) -> str:
|
20
|
-
"""
|
21
|
-
Lädt das Prompt-Template aus der Markdown-Datei.
|
14
|
+
SYSTEM_PROMPT_TEMPLATE = dedent(
|
22
15
|
"""
|
23
|
-
|
24
|
-
|
16
|
+
You are a knowledgeable assistant that helps users create content for Notion pages.
|
17
|
+
Notion supports standard Markdown with some special extensions for creating rich content.
|
18
|
+
|
19
|
+
# Understanding Notion Blocks
|
20
|
+
|
21
|
+
Notion documents are composed of individual blocks. Each block has a specific type (paragraph, heading, list item, etc.) and format.
|
22
|
+
The Markdown syntax you use directly maps to these Notion blocks.
|
23
|
+
|
24
|
+
{element_docs}
|
25
|
+
|
26
|
+
CRITICAL USAGE GUIDELINES:
|
27
|
+
|
28
|
+
1. Do NOT start content with a level 1 heading (# Heading). In Notion, the page title is already displayed in the metadata, so starting with an H1 heading is redundant. Begin with H2 (## Heading) or lower for section headings.
|
29
|
+
|
30
|
+
2. INLINE FORMATTING - VERY IMPORTANT:
|
31
|
+
✅ You can use inline formatting within almost any block type.
|
32
|
+
✅ Combine **bold**, _italic_, `code`, and other formatting as needed.
|
33
|
+
✅ Format text to create visual hierarchy and emphasize important points.
|
34
|
+
❌ DO NOT overuse formatting - be strategic with formatting for best readability.
|
35
|
+
|
36
|
+
3. BACKTICK HANDLING - EXTREMELY IMPORTANT:
|
37
|
+
❌ NEVER wrap entire content or responses in triple backticks (```).
|
38
|
+
❌ DO NOT use triple backticks (```) for anything except CODE BLOCKS or DIAGRAMS.
|
39
|
+
❌ DO NOT use triple backticks to mark or highlight regular text or examples.
|
40
|
+
✅ USE triple backticks ONLY for actual programming code, pseudocode, or specialized notation.
|
41
|
+
✅ For inline code, use single backticks (`code`).
|
42
|
+
✅ When showing Markdown syntax examples, use inline code formatting with single backticks.
|
43
|
+
|
44
|
+
4. BLOCK SEPARATION - IMPORTANT:
|
45
|
+
✅ Use empty lines between different blocks to ensure proper rendering in Notion.
|
46
|
+
✅ For major logical sections, use the spacer element (see documentation below).
|
47
|
+
⚠️ While headings can sometimes work without an empty line before the following paragraph, including empty lines between all block types ensures consistent rendering.
|
25
48
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
except Exception as e:
|
32
|
-
raise RuntimeError(f"Error loading template file: {e}")
|
49
|
+
5. CONTENT FORMATTING - CRITICAL:
|
50
|
+
❌ DO NOT include introductory phrases like "I understand that..." or "Here's the content...".
|
51
|
+
✅ Provide ONLY the requested content directly without any prefacing text or meta-commentary.
|
52
|
+
✅ Generate just the content itself, formatted according to these guidelines."""
|
53
|
+
)
|
33
54
|
|
34
55
|
@staticmethod
|
35
56
|
def generate_element_doc(element_class: Type[NotionBlockElement]) -> str:
|
@@ -86,7 +107,5 @@ class MarkdownSyntaxPromptGenerator:
|
|
86
107
|
"""
|
87
108
|
Generates a complete system prompt for LLMs.
|
88
109
|
"""
|
89
|
-
# Erstelle eine Instanz, um das Template zu laden
|
90
|
-
instance = cls()
|
91
110
|
element_docs = cls.generate_element_docs(element_classes)
|
92
|
-
return
|
111
|
+
return cls.SYSTEM_PROMPT_TEMPLATE.format(element_docs=element_docs)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
notionary/__init__.py,sha256=hPvZ-iqt5R_dAs9KaRBhC5eXzuQ5uvt-9EaU2O_7bZw,691
|
2
|
-
notionary/notion_client.py,sha256=
|
2
|
+
notionary/notion_client.py,sha256=O-lvy2-jMNSDc_8cWKuGVfckCdc1_PiQOlfxQKjQ6_A,7325
|
3
3
|
notionary/database/database_discovery.py,sha256=qDGFhXG9s-_6CXdRg8tMiwX4dvX7jLjgAUFPSNlYtlI,4506
|
4
4
|
notionary/database/notion_database.py,sha256=zbHPejETr101pprd7kewZ555d_TONN_wJi7b9Eyfoyg,7634
|
5
5
|
notionary/database/notion_database_factory.py,sha256=FmijGYz6A4mCWVionOg9sxgFXfb9he52xdgNswJw24k,6584
|
@@ -25,11 +25,11 @@ notionary/elements/toggle_element.py,sha256=h9vYkkAIUHzn-0mu31qC6UPdlk_0EFIsU5A4
|
|
25
25
|
notionary/elements/toggleable_heading_element.py,sha256=XdaPsd8anufwAACL8J-Egd_RcqPqZ1gFlzeol1GOyyc,9960
|
26
26
|
notionary/elements/video_element.py,sha256=y0OmOYXdQBc2rSYAHRmA4l4rzNqPnyhuXbEipcgzQgY,5727
|
27
27
|
notionary/elements/registry/block_registry.py,sha256=giWGcdgc3Z60wvfUr-FS6UMc-k-Q6DlXO8T0gl4fVC8,5027
|
28
|
-
notionary/elements/registry/block_registry_builder.py,sha256=
|
28
|
+
notionary/elements/registry/block_registry_builder.py,sha256=Wnob3PbgzVAoXBW0Eon1KzX4aD4d36KeaDe_uYIKFnU,9311
|
29
29
|
notionary/exceptions/database_exceptions.py,sha256=I-Tx6bYRLpi5pjGPtbT-Mqxvz3BFgYTiuZxknJeLxtI,2638
|
30
30
|
notionary/exceptions/page_creation_exception.py,sha256=4v7IuZD6GsQLrqhDLriGjuG3ML638gAO53zDCrLePuU,281
|
31
31
|
notionary/models/notion_block_response.py,sha256=gzL4C6K9QPcaMS6NbAZaRceSEnMbNwYBVVzxysza5VU,6002
|
32
|
-
notionary/models/notion_database_response.py,sha256=
|
32
|
+
notionary/models/notion_database_response.py,sha256=FMAasQP20S12J_KMdMlNpcHHwxFKX2YtbE4Q9xn-ruQ,1213
|
33
33
|
notionary/models/notion_page_response.py,sha256=r4fwMwwDocj92JdbSmyrzIqBKsnEaz4aDUiPabrg9BM,1762
|
34
34
|
notionary/page/markdown_to_notion_converter.py,sha256=EuqUGNv2HZu67INOnGheeJkt7WHTWGuLnhEG72_Wv5Y,15833
|
35
35
|
notionary/page/notion_page.py,sha256=NDxAJaNk4tlKUrenhKBdnuvjlVgnxC0Z6fprf2LyNeE,18046
|
@@ -49,12 +49,12 @@ notionary/page/relations/notion_page_relation_manager.py,sha256=tfkvLHClaYel_uEa
|
|
49
49
|
notionary/page/relations/notion_page_title_resolver.py,sha256=dIjiEeHjjNT-DrIhz1nynkfHkMpUuJJFOEjb25Wy7f4,3575
|
50
50
|
notionary/page/relations/page_database_relation.py,sha256=8lEp8fQjPwjWhA8nZu3k8mW6EEc54ki1Uwf4iUV1DOU,2245
|
51
51
|
notionary/prompting/element_prompt_content.py,sha256=tHref-SKA81Ua_IQD2Km7y7BvFtHl74haSIjHNYE3FE,4403
|
52
|
-
notionary/prompting/markdown_syntax_prompt_generator.py,sha256=
|
52
|
+
notionary/prompting/markdown_syntax_prompt_generator.py,sha256=0hD2DZDDjQ3ZKHPvZnDKpUs6Puq5O_E2IGW1te1R6v4,4751
|
53
53
|
notionary/util/logging_mixin.py,sha256=b6wHj0IoVSWXbHh0yynfJlwvIR33G2qmaGNzrqyb7Gs,1825
|
54
54
|
notionary/util/page_id_utils.py,sha256=EYNMxgf-7ghzL5K8lKZBZfW7g5CsdY0Xuj4IYmU8RPk,1381
|
55
55
|
notionary/util/warn_direct_constructor_usage.py,sha256=vyJR73F95XVSRWIbyij-82IGOpAne9SBPM25eDpZfSU,1715
|
56
|
-
notionary-0.2.
|
57
|
-
notionary-0.2.
|
58
|
-
notionary-0.2.
|
59
|
-
notionary-0.2.
|
60
|
-
notionary-0.2.
|
56
|
+
notionary-0.2.4.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
|
57
|
+
notionary-0.2.4.dist-info/METADATA,sha256=g51EGI7BvjxmUuUOcrzC9XjS-lYTkKqndxuWp-FZBuY,8374
|
58
|
+
notionary-0.2.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
59
|
+
notionary-0.2.4.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
|
60
|
+
notionary-0.2.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|