feat: Revise prompt and tool descriptions for clarity and accuracy

- Updated the system prompt to provide clearer guidance on the use of deck memory and tools, emphasizing the distinction between historical context and current slide data.
- Enhanced tool descriptions in the ChatTools class to clarify their intended use cases, focusing on live slide data and the importance of using tools for current content.
- Improved instructions on handling slide indices and the retrieval of slide information, ensuring users understand the differences between memory and live data.
This commit is contained in:
sudipnext 2026-04-26 18:28:27 +05:45
parent 35f784379b
commit d1aeff6f82
2 changed files with 28 additions and 17 deletions

View file

@ -10,19 +10,31 @@ def build_system_prompt(
chat_memory_context: str,
) -> str:
presentation_block = _trim_block(
"Deck memory:",
"Deck memory (semantic / long-term: uploaded document text, outline drafts & prompts, stored slide-edit notes; snippets may be partial and can lag the live deck):",
presentation_memory_context,
)
chat_block = _trim_block(
"Chat memory:",
"Chat memory (earlier messages in this conversation only):",
chat_memory_context,
)
return (
"You are Presenton's slide assistant. Be concise, accurate, and action-oriented.\n"
"Use tools for live slide data; tool results override memory. Treat user slide numbers as 1-based and tool indexes as 0-based.\n"
"Use compact reads first: getPresentationOutline, searchSlides, then getSlideAtIndex with includeFullContent=true only before editing.\n"
"Before saving, inspect layouts/schema, batch all needed images/icons with generateAssets, then call saveSlide with schema-valid JSON content.\n"
"Do not invent deck facts. When done with tools, stop calling them and answer briefly with what changed or what you found.\n"
"\n"
"How to use context vs tools\n"
"- RAG / deck memory (the block above labeled Deck memory) is the right place to ground answers about: "
"the uploaded file or its themes, the outline that was generated, planning intent, and source material. "
"It is **not** authoritative for the exact text or order of slides as they exist **right now**.\n"
"- For anything about **current** slides (what a slide actually says, layout, which slide is which, or edits to apply), "
"use tools. After tools run, their results **override** conflicting deck memory.\n"
"- If the user asks about **documents or outlines** (e.g. \"what was in the PDF\", \"original outline\"), search deck memory first; "
"if they ask about **what is on slide N** or to **change a slide**, use getPresentationOutline / searchSlides / getSlideAtIndex, not memory alone.\n"
"\n"
"Tool use (live SQL slide data)\n"
"Treat user slide numbers as 1-based; tool slide indexes are 0-based. "
"Use compact reads first: getPresentationOutline, searchSlides, then getSlideAtIndex; "
"set includeFullContent=true only when you need full JSON (usually right before saveSlide). "
"Before saving, inspect layout/schema, batch images/icons with generateAssets, then saveSlide with valid JSON. "
"Do not invent deck facts. When finished with tools, stop calling them and answer briefly with what changed or what you found.\n"
f"{presentation_block}"
f"{chat_block}"
)

View file

@ -43,10 +43,10 @@ class ChatTools:
Tool(
name="getPresentationOutline",
description=(
"Retrieve the current presentation outline from live slides "
"database state (with memory fallback when needed). "
"Return compact sections (no full slide JSON) to save context "
"window. Use when the user asks about sections, flow, or slide plan."
"Live database: current deck structure. "
"Use for the **actual** slide list/order and compact previews—not for uploaded PDF text or pre-outline RAG. "
"Falls back to stored outlines only if no slide rows exist. "
"Return compact sections (no full slide JSON). Use for flow, sections, or 'what slides exist'."
),
schema=NoArgsInput,
strict=True,
@ -54,8 +54,9 @@ class ChatTools:
Tool(
name="searchSlides",
description=(
"Search SQL slides by semantic intent/keywords and return "
"compact relevant snippets with slide identifiers. "
"Live SQL slides: keyword/semantic style search with snippets and indices. "
"Use to find on-slide text, topics, or which slide mentioned something. "
"For source-document-only questions, rely on deck memory; use this when the question is about **slides as built**. "
"Always provide both query and limit."
),
schema=SearchSlidesInput,
@ -64,11 +65,9 @@ class ChatTools:
Tool(
name="getSlideAtIndex",
description=(
"Retrieve a single slide by zero-based index, including its "
"layout id and compact preview by default. "
"Set includeFullContent=true only when full JSON is explicitly needed "
"(for example before editing existing content). "
"If user says slide N, convert to zero-based index N-1."
"Live SQL: one slide by index—authoritative for exact current content. "
"Set includeFullContent=true when you need full JSON (before saveSlide or precise edits). "
"If user says slide N, use zero-based index N-1."
),
schema=GetSlideAtIndexInput,
strict=True,