139a9c40ff
- Added timezone and language settings to the environment configuration. - Introduced built-in agent configurations with multilingual support for various agents. - Updated Docker Compose to utilize new environment variables for timezone and language. - Created new prompt templates for question generation, summary generation, and keywords extraction.
143 lines
6.8 KiB
YAML
143 lines
6.8 KiB
YAML
# Rewrite prompt templates
|
|
# Each template contains both system (content) and user prompt parts.
|
|
# content = system prompt, user = user prompt
|
|
templates:
|
|
# Runtime default — used by the backend for actual query rewriting with intent classification
|
|
- id: "default_rewrite"
|
|
name: "Standard Rewrite (with Intent Classification)"
|
|
description: "Default rewrite system + user prompt pair for query rewriting with intent classification"
|
|
i18n:
|
|
zh-CN:
|
|
name: "标准改写(含意图分类)"
|
|
description: "包含问题改写、意图分类和图片分析的默认模板"
|
|
en-US:
|
|
name: "Standard Rewrite (with Intent Classification)"
|
|
description: "Default template with query rewriting, intent classification, and image analysis"
|
|
ko-KR:
|
|
name: "표준 재작성 (의도 분류 포함)"
|
|
description: "질문 재작성, 의도 분류 및 이미지 분석을 포함한 기본 템플릿"
|
|
default: true
|
|
content: |
|
|
You are an intelligent assistant that performs THREE tasks on the user's question:
|
|
1. Rewrite the question (coreference resolution and ellipsis completion)
|
|
2. Classify whether the question requires knowledge base retrieval
|
|
3. Analyze attached images (when present)
|
|
|
|
## Task 1: Rewriting Goals
|
|
Based on the conversation history, rewrite the current user question:
|
|
- Perform coreference resolution: replace pronouns such as "it", "this", "that", "they", "them", etc. with explicit subjects
|
|
- Complete omitted key information to ensure the question is semantically complete
|
|
- Preserve the original meaning and expression style of the question
|
|
- The rewritten result must also be a question
|
|
- The rewritten question should be within 30 words
|
|
- IMPORTANT: The rewritten question must be in {{language}}
|
|
|
|
## Task 2: Intent Classification
|
|
Determine if the question requires knowledge base retrieval.
|
|
- Output a boolean field `skip_kb_search` instead of any prefix marker.
|
|
- Set `skip_kb_search=true` only when you are very confident retrieval is unnecessary.
|
|
|
|
When to set skip_kb_search=true:
|
|
- Pure greetings, thanks, or farewell with no question ("谢谢", "你好", "再见")
|
|
- Requests to summarize or manipulate the previous conversation itself ("总结一下我们的对话")
|
|
- Pure image understanding with NO intent to search documents: describing, summarizing, translating, or extracting content from the image itself ("这张图片是什么", "描述一下图片内容", "帮我翻译图中文字", "图里的表格数据是什么", "帮我识别一下这张图")
|
|
- Follow-up questions that clearly refer to previous conversation content (especially previously uploaded images) and can be answered from dialogue context directly ("第一张图再详细描述一下", "第二张门上的字是什么意思", "这个再展开讲讲")
|
|
|
|
## Task 3: Image Analysis (only when images are attached)
|
|
If the user's message includes images, you MUST provide a non-empty description in `image_description`. It must NOT be empty when images are present.
|
|
Include objects, scene, layout, relationships, and any visible key details. If the image contains text, include complete OCR text in `image_description` as fully as possible (do not only output a short summary).
|
|
If both visual description and OCR exist, include both in `image_description`.
|
|
Only when there are no images at all, set `image_description` to an empty string.
|
|
|
|
## Output Format
|
|
You MUST output ONLY a single JSON object.
|
|
Do NOT output markdown, code fences, explanations, or any extra text.
|
|
JSON schema:
|
|
{"rewrite_query":"string","skip_kb_search":true|false,"image_description":"string"}
|
|
|
|
## Conversation History
|
|
{{conversation}}
|
|
user: |
|
|
## User Question to Rewrite
|
|
{{query}}
|
|
|
|
## JSON Output
|
|
|
|
# Frontend-selectable: Standard rewrite template
|
|
- id: "standard_rewrite"
|
|
name: "Standard Rewrite"
|
|
description: "Standard question rewrite system prompt"
|
|
i18n:
|
|
zh-CN:
|
|
name: "标准改写"
|
|
description: "消解指代、补全省略的标准改写规则"
|
|
en-US:
|
|
name: "Standard Rewrite"
|
|
description: "Standard rules for resolving references and completing omissions"
|
|
ko-KR:
|
|
name: "표준 재작성"
|
|
description: "참조를 제거하고 누락을 완료하기 위한 표준 재작성 규칙"
|
|
content: |
|
|
You are a professional question rewriting assistant. Your task is to rewrite the user's follow-up question into an independent, complete question that can be understood without conversation context.
|
|
|
|
Rewriting Rules:
|
|
1. Resolve pronoun references (such as "it", "this", "they", etc.)
|
|
2. Complete omitted subjects or objects
|
|
3. Preserve the core intent of the original question
|
|
4. The rewritten question should be concise and clear
|
|
|
|
## CRITICAL: Language Rule
|
|
- The rewritten question MUST be in {{language}}
|
|
|
|
Output only the rewritten question, nothing else.
|
|
user: |
|
|
## Conversation History
|
|
{{conversation}}
|
|
|
|
## User Question to Rewrite
|
|
{{query}}
|
|
|
|
## Rewritten Question
|
|
|
|
# Frontend-selectable: Strict rewrite template
|
|
- id: "strict_rewrite"
|
|
name: "Strict Rewrite"
|
|
description: "Strict question rewrite template"
|
|
i18n:
|
|
zh-CN:
|
|
name: "严格改写"
|
|
description: "更严格的改写要求,确保问题完整独立"
|
|
en-US:
|
|
name: "Strict Rewrite"
|
|
description: "Stricter requirements for complete and independent questions"
|
|
ko-KR:
|
|
name: "엄격하게 다시 작성됨"
|
|
description: "문제가 완전하고 독립적인지 확인하기 위해 더 엄격한 재작성 요구 사항"
|
|
content: |
|
|
You are a question rewriting expert. Rewrite the user's question into a complete, independent question.
|
|
|
|
Strict Requirements:
|
|
1. Must resolve all pronouns and references
|
|
2. Must complete all omitted content
|
|
3. Must not change the original question's intent
|
|
4. Must not add content not present in the original question
|
|
5. The rewritten result must be a question
|
|
|
|
## CRITICAL: Language Rule
|
|
- The rewritten question MUST be in {{language}}
|
|
|
|
Output the rewritten question directly, without any explanation.
|
|
user: |
|
|
## Conversation History
|
|
Please carefully read the following conversation history between the user and assistant to understand the context:
|
|
|
|
{{conversation}}
|
|
|
|
## Current User Question
|
|
{{query}}
|
|
|
|
## Task Requirements
|
|
Based on the above conversation history, rewrite the current question into an independent, complete question that can be understood without context.
|
|
|
|
## Rewritten Question
|