Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix: align v7 query planner prompt contract (#3983)

Guoxuter5d2ffc1d4fd8
diff --git a/openviking/prompts/templates/retrieval/ov_intent_analysis_sft_v7.yaml b/openviking/prompts/templates/retrieval/ov_intent_analysis_sft_v7.yaml
index 46f5390f0..3360c5c6e 100644
--- a/openviking/prompts/templates/retrieval/ov_intent_analysis_sft_v7.yaml
+++ b/openviking/prompts/templates/retrieval/ov_intent_analysis_sft_v7.yaml
@@ -149,7 +149,7 @@ template: |
6. **Query Style** (optimize for vector / semantic retrieval):
- Queries are embedded and matched against indexed content by **semantic similarity**. Write each query so its embedding lands close to the target content — not necessarily a verbatim fragment, any phrasing that captures the same meaning works.
- **Declarative, not interrogative**: state the information need as a noun/verb phrase rather than a question. Drop question framings ("what / who / when / how is ...").
- - **One information need per query**: each query targets one retrievable fact, relation, comparison, event, or procedure. Do not pile unrelated intents into one query.
+ - **One information need per query**: each query targets one retrievable fact, relation, comparison, event, or procedure. Do not pile unrelated information needs into one query.
- **Self-contained**: resolve pronouns and references using the session context; the retriever only sees the query string.
- **Concept-dense and natural**: use a grammatical, well-formed phrase carrying the key entities, attributes, and qualifiers. Avoid both bare single keywords and telegraphic word-salad.
- **No retrieval-meta words**: exclude words describing the act of retrieval or generic containers ("find", "search", "records", "information about", "content", "details", etc.) — they do not appear in the target content and only dilute the embedding.
@@ -159,12 +159,10 @@ template: |
```json
{
- "reasoning": "1. Task type (operational/informational/conversational); 2. What context is needed (skill/resource/memory); 3. What is already in context; 4. What is missing and needs to be queried",
"queries": [
{
"query": "Specific query text (following the style of the corresponding type)",
"context_type": "skill|resource|memory",
- "intent": "Purpose of the query",
"priority": 1-5
}
]
@@ -174,4 +172,4 @@ template: |
Please output JSON:
llm_config:
- temperature: 0.0
+ temperature: 0.1
diff --git a/tests/prompts/test_retrieval_intent_prompt_contract.py b/tests/prompts/test_retrieval_intent_prompt_contract.py
new file mode 100644
index 000000000..474389464
--- /dev/null
+++ b/tests/prompts/test_retrieval_intent_prompt_contract.py
@@ -0,0 +1,36 @@
+# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
+# SPDX-License-Identifier: AGPL-3.0
+
+import pytest
+
+from openviking.prompts.manager import PromptManager
+
+
+ "prompt_id",
+ [
+ "retrieval.ov_intent_analysis_sft_v4",
+ "retrieval.ov_intent_analysis_sft_v7",
+ ],
+)
+def test_sft_intent_prompts_use_compact_queries_contract(prompt_id: str):
+ manager = PromptManager(templates_dir=PromptManager._get_bundled_templates_dir())
+ rendered = manager.render(
+ prompt_id,
+ {
+ "compression_summary": "The user is working on OpenViking retrieval.",
+ "recent_messages": "[user]: Improve semantic search.",
+ "current_message": "Use the style we discussed earlier.",
+ "context_type": "",
+ "target_abstract": "",
+ },
+ )
+
+ output_contract = rendered.split("## Output Format", maxsplit=1)[1]
+
+ assert "queries" in output_contract
+ assert "query" in output_contract
+ assert "context_type" in output_contract
+ assert "priority" in output_contract
+ assert '"reasoning"' not in output_contract
+ assert '"intent"' not in output_contract