mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-09-01 14:53:07 +08:00
feat(prompt_templates): add document analysis prompt and enhance rewrite template descriptions
- Introduced a new prompt template for document analysis, allowing the assistant to provide detailed responses based on attached documents. - Updated the rewrite template descriptions to clarify the handling of image and document attachments, ensuring better user understanding of intent classification. - Added a new intent type for document-only queries to improve response accuracy. This update enhances the assistant's capabilities in processing and analyzing documents while refining the user experience in intent classification.
This commit is contained in:
@@ -142,3 +142,26 @@ templates:
|
||||
- ALWAYS respond in {{language}}
|
||||
|
||||
Current time: {{current_time}}
|
||||
|
||||
- id: "doc_only"
|
||||
name: "Document Analysis Response"
|
||||
description: "System prompt for pure document understanding"
|
||||
i18n:
|
||||
zh-CN:
|
||||
name: "文档分析回复"
|
||||
description: "针对纯文档/文件理解意图的系统提示词"
|
||||
en-US:
|
||||
name: "Document Analysis Response"
|
||||
description: "System prompt for pure document understanding"
|
||||
ko-KR:
|
||||
name: "문서 분석 응답"
|
||||
description: "순수 문서 이해 의도를 위한 시스템 프롬프트"
|
||||
content: |
|
||||
You are WeKnora, a professional intelligent assistant developed by Tencent, with document analysis capabilities.
|
||||
The user wants you to describe, analyze, summarize, translate, or extract information from the attached document(s) or file(s).
|
||||
Provide a thorough and accurate response based on the document content.
|
||||
Structure your response clearly using Markdown when appropriate.
|
||||
|
||||
## CRITICAL: Language Rule
|
||||
- ALWAYS respond in {{language}}
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ templates:
|
||||
i18n:
|
||||
zh-CN:
|
||||
name: "标准改写(含意图分类)"
|
||||
description: "包含问题改写、意图分类和图片分析的默认模板"
|
||||
description: "包含问题改写、意图分类和图片/附件分析的默认模板"
|
||||
en-US:
|
||||
name: "Standard Rewrite (with Intent Classification)"
|
||||
description: "Default template with query rewriting, intent classification, and image analysis"
|
||||
description: "Default template with query rewriting, intent classification, and image/attachment analysis"
|
||||
ko-KR:
|
||||
name: "표준 재작성 (의도 분류 포함)"
|
||||
description: "질문 재작성, 의도 분류 및 이미지 분석을 포함한 기본 템플릿"
|
||||
description: "질문 재작성, 의도 분류 및 이미지/첨부 파일 분석을 포함한 기본 템플릿"
|
||||
default: true
|
||||
content: |
|
||||
You are an intelligent assistant that performs THREE tasks on the user's question:
|
||||
@@ -40,19 +40,20 @@ templates:
|
||||
1. `greeting` — Pure greetings, thanks, or farewell with NO substantive question (e.g. "你好", "谢谢", "再见").
|
||||
2. `summarize` — The user asks to summarize, organize, or review the conversation itself (e.g. "总结一下我们的对话").
|
||||
3. `web_search` — The question explicitly asks for real-time, latest, or external information unlikely in the knowledge base (e.g. "今天天气怎么样", "最新的新闻").
|
||||
4. `kb_search` — The user wants to search, find, query, or verify information that could exist in the knowledge base. **This applies even when images are attached** — if the user's intent involves searching or matching against stored documents, it is `kb_search`, NOT `image_only` (e.g. "知识库里有这个文件吗", "帮我查一下这个", "能找到相关的资料吗").
|
||||
4. `kb_search` — The user wants to search, find, query, or verify information that could exist in the knowledge base. **This applies even when images or documents are attached** — if the user's intent involves searching or matching against stored documents, it is `kb_search`, NOT `image_only` or `doc_only` (e.g. "知识库里有这个文件吗", "帮我查一下这个", "能找到相关的资料吗").
|
||||
5. `clarification` — The question is ambiguous or incomplete and likely needs KB retrieval to answer well.
|
||||
6. `follow_up` — The question clearly refers to previous conversation content and can be FULLY answered from dialogue history alone, with NO need for new retrieval (e.g. "上面第三点展开讲讲", "你刚才说的那个方案再详细说说").
|
||||
7. `image_only` — The user ONLY wants to understand, describe, translate, or extract content from the attached image itself, with NO intent to search or match against any external documents (e.g. "这张图片是什么", "描述一下图片内容", "翻译图中文字").
|
||||
8. `chitchat` — Casual conversation or small talk that needs no retrieval (e.g. "你是谁", "讲个笑话").
|
||||
8. `doc_only` — The user ONLY wants to understand, summarize, translate, or extract content from the attached document/file itself, with NO intent to search or match against any external knowledge base (e.g. "总结一下这个文档", "这份文件讲了什么").
|
||||
9. `chitchat` — Casual conversation or small talk that needs no retrieval (e.g. "你是谁", "讲个笑话").
|
||||
|
||||
**Default: when unsure, always choose `kb_search`.**
|
||||
|
||||
Key distinction — `image_only` vs `kb_search` with images:
|
||||
- User uploads image + "这是什么" → `image_only` (only wants image description)
|
||||
- User uploads image + "知识库里有这个吗" → `kb_search` (wants to search KB)
|
||||
- User uploads image + "帮我找相关文档" → `kb_search` (wants to search KB)
|
||||
- User uploads image + "翻译图中文字" → `image_only` (only wants image content)
|
||||
Key distinction — `image_only` / `doc_only` vs `kb_search` with attachments:
|
||||
- User uploads image/doc + "这是什么" / "总结一下" → `image_only` / `doc_only` (only wants to analyze the attachment)
|
||||
- User uploads image/doc + "知识库里有这个吗" → `kb_search` (wants to search KB)
|
||||
- User uploads image/doc + "帮我找相关文档" → `kb_search` (wants to search KB)
|
||||
- User uploads image/doc + "翻译文件内容" → `image_only` / `doc_only` (only wants to analyze the attachment)
|
||||
|
||||
Key distinction — `follow_up` vs `kb_search`:
|
||||
- "上面第二点再详细说说" with sufficient context in history → `follow_up`
|
||||
@@ -94,6 +95,9 @@ templates:
|
||||
Input: [image attached] "这张图是什么意思"
|
||||
Output: {"rewrite_query":"这张图是什么意思","intent":"image_only","image_description":"(image description here)"}
|
||||
|
||||
Input: [document attached] "帮我总结一下这份文件"
|
||||
Output: {"rewrite_query":"总结一下这份文件","intent":"doc_only","image_description":""}
|
||||
|
||||
## Conversation History
|
||||
{{conversation}}
|
||||
user: |
|
||||
|
||||
@@ -68,6 +68,7 @@ const (
|
||||
IntentChitchat QueryIntent = "chitchat"
|
||||
IntentFollowUp QueryIntent = "follow_up"
|
||||
IntentImageOnly QueryIntent = "image_only"
|
||||
IntentDocOnly QueryIntent = "doc_only"
|
||||
IntentSummarize QueryIntent = "summarize"
|
||||
IntentClarification QueryIntent = "clarification"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user