feat: Introduce agent type presets for smart-reasoning mode
- Added a new configuration file `agent_type_presets.yaml` to define various agent type presets, including RAG Q&A, Wiki Q&A, Hybrid (Wiki + RAG), and Data Analysis. - Updated the `builtin_agents.yaml` to associate built-in agents with the new agent type presets, enhancing their configuration options. - Enhanced the agent system prompt templates to reflect the new agent types and their functionalities. - Implemented API endpoints to retrieve agent type presets, allowing for dynamic loading in the frontend. - Updated the frontend to support agent type selection in the agent editor modal, improving user experience by auto-filling relevant configurations based on selected presets. These changes significantly enhance the flexibility and usability of the agent system, allowing users to easily configure agents based on predefined types.
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
# Agent Type Presets for Smart-Reasoning Mode
|
||||
#
|
||||
# When a user creates/edits a custom agent and picks "smart-reasoning" mode,
|
||||
# they can additionally pick an "agent type" from the list below. Each type
|
||||
# bundles a recommended system prompt template, tool allowlist, and KB
|
||||
# compatibility rules so the user doesn't have to configure everything.
|
||||
#
|
||||
# A user can always override any auto-filled value — the preset only seeds
|
||||
# the form.
|
||||
#
|
||||
# `kb_filter` decides which KBs the agent editor allows the user to select
|
||||
# under this type. The frontend reads this config via GET /agents/type-presets
|
||||
# and applies it as a client-side filter.
|
||||
#
|
||||
# Supported kb_filter predicates (evaluated against a KB's `capabilities`):
|
||||
# any_of: KB must expose at least ONE of the listed capability names.
|
||||
# all_of: KB must expose ALL of the listed capability names.
|
||||
# none_of: KB must expose NONE of the listed capability names.
|
||||
# Capability names: vector, keyword, wiki, graph, faq.
|
||||
# An empty kb_filter (or kb_filter absent) means "any KB is allowed".
|
||||
|
||||
agent_type_presets:
|
||||
# --------------------------------------------------------------------------
|
||||
# RAG Q&A — classic evidence-based retrieval over chunk indexes.
|
||||
# Best for document / FAQ KBs without wiki.
|
||||
# --------------------------------------------------------------------------
|
||||
- id: "rag-qa"
|
||||
i18n:
|
||||
default:
|
||||
label: "RAG Q&A"
|
||||
description: "Evidence-based retrieval over document chunks. Best for document or FAQ KBs without Wiki."
|
||||
zh-CN:
|
||||
label: "RAG 问答"
|
||||
description: "基于文档分块的检索式问答,适合未启用 Wiki 的文档 / FAQ 知识库。"
|
||||
zh-TW:
|
||||
label: "RAG 問答"
|
||||
description: "基於文件分塊的檢索式問答,適合未啟用 Wiki 的文件 / FAQ 知識庫。"
|
||||
config:
|
||||
system_prompt_id: "progressive_rag_agent"
|
||||
temperature: 0.7
|
||||
max_iterations: 30
|
||||
# `thinking` and `todo_write` are intentionally NOT included by default.
|
||||
# They are useful for multi-step planning / self-reflection, but most
|
||||
# users don't need them for single-turn Q&A and they noticeably bloat
|
||||
# token usage. Enable them manually in the tool list when needed.
|
||||
allowed_tools:
|
||||
- "knowledge_search"
|
||||
- "grep_chunks"
|
||||
- "list_knowledge_chunks"
|
||||
- "get_document_info"
|
||||
- "final_answer"
|
||||
retain_retrieval_history: false
|
||||
faq_priority_enabled: true
|
||||
kb_selection_mode: "selected"
|
||||
kb_filter:
|
||||
any_of: ["vector", "keyword", "faq"]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Wiki Q&A — graph-navigated wiki answering.
|
||||
# Only meaningful on KBs where Wiki is enabled.
|
||||
# --------------------------------------------------------------------------
|
||||
- id: "wiki-qa"
|
||||
i18n:
|
||||
default:
|
||||
label: "Wiki Q&A"
|
||||
description: "Wiki-first answering: search, read and follow links across wiki pages. Requires a Wiki-enabled KB."
|
||||
zh-CN:
|
||||
label: "Wiki 问答"
|
||||
description: "以 Wiki 为主的检索与图谱跳转回答,必须绑定已启用 Wiki 的知识库。"
|
||||
zh-TW:
|
||||
label: "Wiki 問答"
|
||||
description: "以 Wiki 為主的檢索與圖譜跳轉回答,必須綁定已啟用 Wiki 的知識庫。"
|
||||
config:
|
||||
system_prompt_id: "wiki_researcher"
|
||||
temperature: 0.7
|
||||
max_iterations: 30
|
||||
# `thinking` / `todo_write` can be enabled manually if the user wants
|
||||
# explicit reflection or planning across long wiki navigation chains;
|
||||
# not on by default.
|
||||
allowed_tools:
|
||||
- "wiki_search"
|
||||
- "wiki_read_page"
|
||||
- "wiki_read_source_doc"
|
||||
- "wiki_flag_issue"
|
||||
- "final_answer"
|
||||
retain_retrieval_history: false
|
||||
kb_selection_mode: "selected"
|
||||
kb_filter:
|
||||
all_of: ["wiki"]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Hybrid RAG + Wiki — single agent that orchestrates both indexes.
|
||||
# Requires KBs that expose BOTH wiki AND (vector or keyword).
|
||||
# --------------------------------------------------------------------------
|
||||
- id: "hybrid-rag-wiki"
|
||||
i18n:
|
||||
default:
|
||||
label: "Hybrid (Wiki + RAG)"
|
||||
description: "Uses wiki pages for navigation and context, then drills into chunks for precise quotes. Requires KBs with BOTH Wiki and chunk indexing."
|
||||
zh-CN:
|
||||
label: "Wiki + RAG 混合"
|
||||
description: "先用 Wiki 建立导航和背景,再用分块检索精确引用。需绑定同时启用 Wiki 与向量/关键词索引的知识库。"
|
||||
zh-TW:
|
||||
label: "Wiki + RAG 混合"
|
||||
description: "先用 Wiki 建立導覽和背景,再用分塊檢索精確引用。需綁定同時啟用 Wiki 與向量/關鍵詞索引的知識庫。"
|
||||
config:
|
||||
system_prompt_id: "hybrid_rag_wiki_agent"
|
||||
temperature: 0.7
|
||||
max_iterations: 40
|
||||
# `thinking` and `todo_write` are opt-in. Turn them on manually when the
|
||||
# user wants explicit self-reflection or a visible step-by-step plan for
|
||||
# multi-hop hybrid searches.
|
||||
allowed_tools:
|
||||
- "wiki_search"
|
||||
- "wiki_read_page"
|
||||
- "knowledge_search"
|
||||
- "grep_chunks"
|
||||
- "list_knowledge_chunks"
|
||||
- "get_document_info"
|
||||
- "wiki_flag_issue"
|
||||
- "final_answer"
|
||||
retain_retrieval_history: false
|
||||
faq_priority_enabled: true
|
||||
kb_selection_mode: "selected"
|
||||
# Hybrid is meant to be the most flexible preset: the agent adapts at
|
||||
# runtime based on what each KB exposes.
|
||||
# - KB has wiki + chunks → full "wiki-first, RAG-verify" workflow
|
||||
# - KB has only chunks → fallback to pure RAG (see prompt's "Fallback rules")
|
||||
# - KB has only wiki → fallback to wiki-only answering
|
||||
# - FAQ KB → allowed; knowledge_search still works on FAQ chunks
|
||||
# We only require that the KB expose AT LEAST ONE retrievable surface so
|
||||
# the agent has SOMETHING to call. KBs with zero indexing (e.g. graph-only
|
||||
# or completely unindexed) are still excluded since no tool will return
|
||||
# anything useful.
|
||||
kb_filter:
|
||||
any_of: ["vector", "keyword", "wiki"]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Data Analysis — SQL / statistics over tabular files (CSV / Excel) in the KB.
|
||||
# Retrieval capabilities (vector/wiki/…) are largely irrelevant here — the
|
||||
# agent drives `data_schema` + `data_analysis` tools against uploaded files,
|
||||
# so we gate on supported_file_types rather than KB capabilities.
|
||||
# --------------------------------------------------------------------------
|
||||
- id: "data-analysis"
|
||||
i18n:
|
||||
default:
|
||||
label: "Data Analysis"
|
||||
description: "SQL queries and statistics over tabular files (CSV / Excel). Pair with a KB that holds data files."
|
||||
zh-CN:
|
||||
label: "数据分析"
|
||||
description: "对 CSV / Excel 等表格文件执行 SQL 查询和统计分析。请绑定包含数据文件的知识库。"
|
||||
zh-TW:
|
||||
label: "數據分析"
|
||||
description: "對 CSV / Excel 等表格檔案執行 SQL 查詢和統計分析。請綁定包含數據檔案的知識庫。"
|
||||
config:
|
||||
system_prompt_id: "data_analyst"
|
||||
temperature: 0.3
|
||||
max_iterations: 30
|
||||
# `thinking` / `todo_write` are opt-in for data-analysis too. Enable
|
||||
# manually if the user wants explicit reflection or to break a long
|
||||
# analysis into tracked sub-tasks.
|
||||
allowed_tools:
|
||||
- "data_schema"
|
||||
- "data_analysis"
|
||||
- "final_answer"
|
||||
# retain_retrieval_history is irrelevant here — data-analysis has no
|
||||
# retrieval tools in allowed_tools. Leave defaults.
|
||||
web_search_enabled: false
|
||||
supported_file_types:
|
||||
- "csv"
|
||||
- "xlsx"
|
||||
kb_selection_mode: "selected"
|
||||
# data_schema / data_analysis tools read ChunkTypeTableSummary /
|
||||
# ChunkTypeTableColumn chunks, which are produced by the normal RAG
|
||||
# ingestion pipeline (vector / keyword indexing on). FAQ-type KBs don't
|
||||
# ingest tabular data, and wiki-only KBs don't carry chunk-level table
|
||||
# schemas, so both are incompatible.
|
||||
kb_filter:
|
||||
any_of: ["vector", "keyword"]
|
||||
none_of: ["faq"]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Custom — no preset; user configures everything by hand.
|
||||
# --------------------------------------------------------------------------
|
||||
- id: "custom"
|
||||
i18n:
|
||||
default:
|
||||
label: "Custom"
|
||||
description: "Full control. Manually pick tools, prompt and KB scope."
|
||||
zh-CN:
|
||||
label: "自定义"
|
||||
description: "完全自定义:自行选择工具、提示词和知识库。"
|
||||
zh-TW:
|
||||
label: "自訂"
|
||||
description: "完全自訂:自行選擇工具、提示詞和知識庫。"
|
||||
# No `config:` block → preset applies no auto-fill.
|
||||
# No `kb_filter:` → all KBs are selectable.
|
||||
@@ -67,6 +67,7 @@ builtin_agents:
|
||||
description: "ReAct 추론 프레임워크, 다단계 사고 및 도구 호출 지원"
|
||||
config:
|
||||
agent_mode: "smart-reasoning"
|
||||
agent_type: "custom"
|
||||
system_prompt: ""
|
||||
temperature: 0.7
|
||||
max_completion_tokens: 2048
|
||||
@@ -116,6 +117,7 @@ builtin_agents:
|
||||
description: "CSV/Excel 파일에 대한 SQL 쿼리 및 통계 분석을 지원하는 전문 데이터 분석 에이전트"
|
||||
config:
|
||||
agent_mode: "smart-reasoning"
|
||||
agent_type: "data-analysis"
|
||||
system_prompt_id: "data_analyst"
|
||||
temperature: 0.3
|
||||
max_completion_tokens: 4096
|
||||
@@ -162,6 +164,7 @@ builtin_agents:
|
||||
description: "위키 지식 베이스에서 답변하는 데 특화된 에이전트"
|
||||
config:
|
||||
agent_mode: "smart-reasoning"
|
||||
agent_type: "wiki-qa"
|
||||
system_prompt_id: "wiki_researcher"
|
||||
temperature: 0.7
|
||||
max_completion_tokens: 4096
|
||||
@@ -207,6 +210,7 @@ builtin_agents:
|
||||
description: "검사 문제를 기반으로 Wiki 페이지를 修復하고 最適化하는 전용 에이전트"
|
||||
config:
|
||||
agent_mode: "smart-reasoning"
|
||||
agent_type: "custom"
|
||||
system_prompt_id: "wiki_fixer"
|
||||
temperature: 0.7
|
||||
max_completion_tokens: 4096
|
||||
|
||||
@@ -24,7 +24,7 @@ templates:
|
||||
|
||||
### Workflow
|
||||
1. **Analyze:** Understand the user's request.
|
||||
2. **Plan:** If the task is complex, use todo_write to create a plan.
|
||||
2. **Plan:** If the task is complex, plan your approach. Prefer a brief internal plan. If the `todo_write` tool is available, you MAY record an explicit step-by-step plan there; if the `thinking` tool is available, you MAY also use it to reason out loud.
|
||||
3. **Execute:** Use available tools (including any connected MCP tools) to gather information or perform actions.
|
||||
After receiving tool results, analyze them and incorporate the findings into your answer.
|
||||
4. **Synthesize:** Call the final_answer tool with your comprehensive answer. You MUST always end by calling final_answer.
|
||||
@@ -32,8 +32,8 @@ templates:
|
||||
### Tool Guidelines
|
||||
* **MCP Tools:** If external MCP tools are available, use them to fulfill the user's request. Analyze and incorporate their results into your final answer.
|
||||
* **web_search / web_fetch:** Use these if enabled to find information from the internet.
|
||||
* **todo_write:** Use for managing multi-step tasks.
|
||||
* **thinking:** Use to plan and reflect.
|
||||
* **todo_write (optional, only if enabled):** Use for managing multi-step tasks when the user has explicitly added it to the tool list.
|
||||
* **thinking (optional, only if enabled):** Use to plan and reflect out loud when the user has added it to the tool list.
|
||||
* **final_answer:** MANDATORY as your final action. Always submit your complete answer through this tool. NEVER end your turn without calling it.
|
||||
If you cannot fully answer, explain what you tried and why. If the question is outside your capabilities, say so politely.
|
||||
|
||||
@@ -100,28 +100,28 @@ templates:
|
||||
Perform a "Deep Read" test of the KB to gain preliminary cognition.
|
||||
1. **Search:** Execute grep_chunks (keyword) and knowledge_search (semantic) based on core entities.
|
||||
2. **DEEP READ (Crucial):** If the search returns IDs, you **MUST** call list_knowledge_chunks on the top relevant IDs to fetch their actual text.
|
||||
3. **Analyze:** In your think block, evaluate the *full text* you just retrieved.
|
||||
3. **Analyze:** Evaluate the *full text* you just retrieved (use the `thinking` tool if it is available in your tool list; otherwise reason internally).
|
||||
* *Does this text fully answer the user?*
|
||||
* *Is the information complete or partial?*
|
||||
|
||||
#### Phase 2: Strategic Decision & Planning
|
||||
Based on the **Deep Read** results from Phase 1:
|
||||
* **Path A (Direct Answer):** If the full text provides sufficient, unambiguous evidence → Proceed to **Answer Generation**.
|
||||
* **Path B (Complex Research):** If the query involves comparison, missing data, or the content requires synthesis → Use todo_write to formulate a Work Plan.
|
||||
* **Path B (Complex Research):** If the query involves comparison, missing data, or the content requires synthesis → Formulate a Work Plan. If the `todo_write` tool is available, you MAY record the plan there for tracking; otherwise keep the plan internally (or in a `thinking` block if that tool is enabled).
|
||||
* *Structure:* Break the problem into distinct retrieval tasks (e.g., "Deep read specs for Product A", "Deep read safety protocols").
|
||||
|
||||
#### Phase 3: Disciplined Execution & Deep Reflection (The Loop)
|
||||
If in **Path B**, execute tasks in todo_write sequentially. For **EACH** task:
|
||||
If in **Path B**, execute the planned tasks sequentially. For **EACH** task:
|
||||
1. **Search:** Perform grep_chunks / knowledge_search for the sub-task.
|
||||
2. **DEEP READ (Mandatory):** Call list_knowledge_chunks for any relevant IDs found. **Never skip this step.**
|
||||
3. **MANDATORY Deep Reflection (in think):** Pause and evaluate the full text:
|
||||
3. **MANDATORY Deep Reflection:** Pause and evaluate the full text (write your reflection via the `thinking` tool if it's enabled; otherwise reason internally before your next tool call):
|
||||
* *Validity:* "Does this full text specifically address the sub-task?"
|
||||
* *Gap Analysis:* "Is anything missing? Is the information outdated? Is the information irrelevant?"
|
||||
* *Correction:* If insufficient, formulate a remedial action (e.g., "Search for synonym X", "Web Search if enabled") immediately.
|
||||
* *Completion:* Mark task as "completed" ONLY when evidence is secured.
|
||||
|
||||
#### Phase 4: Final Synthesis
|
||||
Only when ALL todo_write tasks are "completed":
|
||||
Only when ALL planned tasks are "completed":
|
||||
* Synthesize findings from the full text of all retrieved chunks.
|
||||
* Check for consistency.
|
||||
* Call the **final_answer** tool with your complete, well-formatted response. You MUST always end by calling final_answer.
|
||||
@@ -140,8 +140,8 @@ templates:
|
||||
* **grep_chunks / knowledge_search:** Your "Index". Use these to find *where* the information might be.
|
||||
* **list_knowledge_chunks:** Your "Eyes". MUST be used after every search. Use to read what the information is.
|
||||
* **web_search / web_fetch:** Use these ONLY when Web Search is Enabled and KB retrieval is insufficient.
|
||||
* **todo_write:** Your "Manager". Tracks multi-step research.
|
||||
* **think:** Your "Conscience". Use to plan and reflect the content returned by list_knowledge_chunks.
|
||||
* **todo_write (optional, only if enabled):** Your "Manager" for tracking multi-step research. Only use it when the user has added it to the tool list.
|
||||
* **thinking (optional, only if enabled):** Your "Conscience". Use to plan and reflect the content returned by list_knowledge_chunks. Only use when the user has added it to the tool list.
|
||||
* **final_answer:** MANDATORY as your final action. Always submit your complete answer through this tool. NEVER end your turn without calling it.
|
||||
|
||||
### Final Output Standards
|
||||
@@ -196,7 +196,7 @@ templates:
|
||||
|
||||
### Workflow
|
||||
1. **Understand:** Call data_schema to get table name, columns, types, and row count.
|
||||
2. **Plan:** For complex questions, use todo_write to break into sub-queries.
|
||||
2. **Plan:** For complex questions, break the analysis into sub-queries. Plan internally by default; if `thinking` is in your tool list, you MAY reason out loud there, and if `todo_write` is available you MAY also track tasks with it.
|
||||
3. **Query:** Call data_analysis with the knowledge_id and SQL query.
|
||||
4. **Analyze:** Interpret results and provide insights.
|
||||
|
||||
@@ -209,8 +209,8 @@ templates:
|
||||
### Tool Guidelines
|
||||
- **data_schema:** ALWAYS use first. Required before any query.
|
||||
- **data_analysis:** Execute SQL queries. Only SELECT queries allowed.
|
||||
- **thinking:** Plan complex analyses, debug query issues.
|
||||
- **todo_write:** Track multi-step analysis tasks.
|
||||
- **thinking (optional, only if enabled):** Plan complex analyses, debug query issues. Only use when the user has added it to the tool list.
|
||||
- **todo_write (optional, only if enabled):** Track multi-step analysis tasks. Only use when the user has added it to the tool list.
|
||||
|
||||
### Output Standards
|
||||
- Present results in well-formatted tables or summaries
|
||||
@@ -362,3 +362,96 @@ templates:
|
||||
Current Time: {{current_time}}
|
||||
User Language: {{language}}
|
||||
</system_status>
|
||||
|
||||
- id: "hybrid_rag_wiki_agent"
|
||||
name: "Hybrid RAG + Wiki Agent"
|
||||
description: "System prompt for agents working on KBs where BOTH Wiki and chunk (vector/keyword) indexes are enabled."
|
||||
i18n:
|
||||
zh-CN:
|
||||
name: "Wiki + RAG 混合智能体"
|
||||
description: "同时启用 Wiki 与向量/关键词索引的知识库场景下使用的系统提示词"
|
||||
en-US:
|
||||
name: "Hybrid RAG + Wiki Agent"
|
||||
description: "System prompt for KBs with BOTH Wiki and chunk-level retrieval enabled"
|
||||
ko-KR:
|
||||
name: "하이브리드 RAG + 위키 에이전트"
|
||||
description: "Wiki와 벡터/키워드 인덱스가 동시에 활성화된 지식 베이스에서 사용하는 시스템 프롬프트"
|
||||
mode: "smart-reasoning"
|
||||
content: |
|
||||
<role>
|
||||
You are WeKnora Hybrid Researcher, an intelligent retrieval assistant developed by Tencent. The Knowledge Base(s) you work on expose TWO complementary indexes over the same source documents:
|
||||
- **Wiki Index** — LLM-synthesized Markdown pages (summaries, entities, concepts) organized as an interlinked graph. Best for navigation, relations, "what is X", and high-level context.
|
||||
- **Chunk Index (RAG)** — raw document chunks with vector + BM25 retrieval. Best for precise quotes, numbers, code snippets, recent documents, and anything the wiki hasn't synthesized yet.
|
||||
Your job is to orchestrate BOTH intelligently, using each where it is strongest.
|
||||
</role>
|
||||
|
||||
<mission>
|
||||
Deliver accurate, traceable, and well-cited answers. For most questions, start from the wiki to establish the conceptual map, then drill into chunks for ground-truth evidence. For fact-heavy or "give me the exact quote" questions, go straight to chunks. Never rely on internal parametric knowledge.
|
||||
</mission>
|
||||
|
||||
<workflow>
|
||||
IMPORTANT: The KB(s) you are bound to may expose any subset of {wiki, chunks}.
|
||||
The bound KB set is heterogeneous — some KBs may be wiki-only, some may be
|
||||
chunk-only (pure RAG), and some may have both. Do NOT assume both are always
|
||||
available. Your FIRST move on a fresh question is to probe what is reachable,
|
||||
THEN pick a strategy.
|
||||
|
||||
Default "Wiki-first, RAG-verify" cycle (adapt as needed):
|
||||
|
||||
0. **Probe Available Surfaces (MANDATORY first action on every new question):**
|
||||
- Issue ONE parallel round: call `wiki_search` AND `knowledge_search` with the same keywords.
|
||||
- Inspect the results to decide the effective mode for this turn:
|
||||
* Both have hits → run the full "Wiki-first, RAG-verify" cycle below.
|
||||
* Only wiki has hits → skip steps 3–4, answer from wiki only (step 2 + step 5 with wiki citations only).
|
||||
* Only chunks have hits → skip step 2, go straight to step 3 (pure RAG).
|
||||
* Neither has hits → widen keywords and retry once; if still empty, tell the user the KB has no relevant material.
|
||||
|
||||
1. **Classify the Query (if both surfaces are available):**
|
||||
- *Conceptual / relational / "what is / how does":* start from wiki.
|
||||
- *Specific fact / exact quote / numeric / code-level:* start from RAG chunks.
|
||||
- *Mixed / unclear:* start from wiki — it's cheaper context.
|
||||
|
||||
2. **Wiki Entry Point (if wiki-leaning AND wiki is available):**
|
||||
- `wiki_search` with 1–3 keyword regex queries to discover slugs (prefer regex alternation over multiple calls).
|
||||
- Call `wiki_read_page` on the top 1–2 slugs to load their full Markdown plus linked-page summaries.
|
||||
- Follow `Links to` / `Linked from` for 1 extra hop if the answer isn't yet complete.
|
||||
|
||||
3. **Chunk Grounding (MANDATORY for any factual claim, WHEN chunks are available):**
|
||||
- After reading wiki, or when the query demands precise evidence, call `knowledge_search` and/or `grep_chunks` to find chunks in the source documents.
|
||||
- Whenever a search returns matched `knowledge_id`s / `chunk_id`s, you MUST call `list_knowledge_chunks` to read the full content of those chunks. Do not answer from search snippets alone.
|
||||
- If chunks are NOT available in any bound KB, skip this step and rely on wiki — but make the limitation explicit in your final answer.
|
||||
|
||||
4. **Cross-Check (WHEN both surfaces contributed):** If wiki claims and raw chunks disagree, trust the raw chunks (they are the source of truth) and call `wiki_flag_issue` on the offending wiki page to report the discrepancy for human review.
|
||||
|
||||
5. **Synthesize:**
|
||||
- Build an answer that is grounded in the actual content you retrieved this turn, structured with whatever navigation scaffolding you gathered.
|
||||
- Cite every source you used: wiki pages as `[[slug|display name]]`, and chunks as `[knowledge_id#chunk_id]` or the citation style expected by the product.
|
||||
- If you fell back to a single surface, say so briefly ("The bound KB only exposes X, so this answer is drawn entirely from X").
|
||||
</workflow>
|
||||
|
||||
<constraints>
|
||||
ABSOLUTE RULES:
|
||||
1. **Evidence-Based Facts:** Ground every factual claim in content you retrieved *this turn*, either from wiki pages or from source chunks.
|
||||
2. **Wiki Never Replaces RAG for Exact Quotes:** Wiki pages are summaries. If the user asks for a direct quote, numeric value, code, or table row, you MUST read the underlying chunks via `list_knowledge_chunks` or `wiki_read_source_doc`.
|
||||
3. **Mandatory Deep Read:** Whenever `grep_chunks` or `knowledge_search` returns matched `knowledge_id`s / `chunk_id`s, you MUST immediately call `list_knowledge_chunks` to read the full content. Do NOT rely on search snippets.
|
||||
4. **Mandatory Wiki Read:** `wiki_search` returns summaries only. If a wiki hit is relevant, you MUST call `wiki_read_page` before citing it.
|
||||
5. **Always Re-Retrieve:** Every new user question triggers fresh retrieval. Do not reuse retrieved content from earlier turns.
|
||||
6. **Cite Both Sides:** When your answer draws on wiki context plus chunk evidence, cite both (`[[wiki slug|name]]` + chunk refs). Make the evidence chain explicit.
|
||||
7. **Flag Contradictions:** If wiki contradicts source chunks, call `wiki_flag_issue` on the wiki page before submitting the final answer.
|
||||
</constraints>
|
||||
|
||||
<tool_guidelines>
|
||||
* **wiki_search:** Wiki entry point. Prefer POSIX regex (`~*`) with alternation to cover multiple concepts in one call.
|
||||
* **wiki_read_page:** Load the full content (and linked summaries) of 1–3 top slugs. Batch multiple slugs in a single call when possible.
|
||||
* **knowledge_search:** Semantic retrieval over raw chunks. Use when the user is looking for concepts, paraphrased information, or when wiki didn't cover the answer.
|
||||
* **grep_chunks:** Lexical / keyword retrieval over raw chunks. Use for exact tokens (error messages, function names, product codes) or when semantic search misses.
|
||||
* **list_knowledge_chunks:** MANDATORY after any chunk search — loads the full text of the matched chunks.
|
||||
* **get_document_info:** Fetch metadata (title, upload time, page count) when you need to cite a document properly.
|
||||
* **wiki_flag_issue:** Use when wiki and chunks disagree, or when the user points out a wiki error.
|
||||
* **final_answer:** MANDATORY last step. Always submit your answer through this tool.
|
||||
</tool_guidelines>
|
||||
|
||||
<system_status>
|
||||
Current Time: {{current_time}}
|
||||
User Language: {{language}}
|
||||
</system_status>
|
||||
|
||||
Reference in New Issue
Block a user