Skip to content

feat(search) Add lightweight query planner config for intent analysis#2224

Open
heaoxiang-ai wants to merge 7 commits into
volcengine:mainfrom
heaoxiang-ai:query_planer
Open

feat(search) Add lightweight query planner config for intent analysis#2224
heaoxiang-ai wants to merge 7 commits into
volcengine:mainfrom
heaoxiang-ai:query_planer

Conversation

@heaoxiang-ai
Copy link
Copy Markdown
Contributor

@heaoxiang-ai heaoxiang-ai commented May 25, 2026

Description

Adds an optional dedicated query planner model configuration for OpenViking retrieval intent analysis. When configured, search intent analysis uses this lightweight planner instead of the general VLM; when omitted or empty, OpenViking preserves the existing behavior and falls back to vlm.

The PR keeps the default example config unchanged to avoid implying that every deployment should run a local intent-analysis model. The opt-in planner setup is documented in the configuration guide instead.

Related Issue

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Test update

Changes Made

  • Added top-level query_planner config support using the existing VLMConfig shape.
  • Added OpenVikingConfig.get_query_planner() to centralize fallback to vlm when query_planner is unset or empty.
  • Updated IntentAnalyzer to call the configured query planner for retrieval intent analysis and query planning.
  • Documented query_planner in English and Chinese configuration guides as an optional opt-in setting.
  • Added tests/retrieve/test_intent_analyzer_query_planner.py for config parsing and planner-vs-VLM routing behavior.
  • Added scripts/test_ov_intent_planner.py as a local smoke test for validating query planner wiring against representative intent-analysis scenarios.

Testing

  • python -m pytest tests/retrieve/test_intent_analyzer_query_planner.py passed: 4 passed, 4 warnings.
  • Local smoke test was run against an Ollama-backed query planner and returned typed query plans for operational, informational, and memory-constrained scenarios, plus an empty query list for a conversational scenario.

Checklist

  • Code follows the existing project style.
  • I have performed a self-review of the changes.
  • I have run relevant local verification.
  • I have added or updated automated tests where appropriate.
  • I have updated documentation where appropriate.

Screenshots

N/A

Additional Notes

The new config is backward-compatible: existing deployments without query_planner continue using vlm for intent analysis.

@heaoxiang-ai heaoxiang-ai changed the title [codex] Add lightweight query planner config for intent analysis [feat] Add lightweight query planner config for intent analysis May 25, 2026
@heaoxiang-ai heaoxiang-ai changed the title [feat] Add lightweight query planner config for intent analysis feat(search) Add lightweight query planner config for intent analysis May 25, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

PR Reviewer Guide 🔍

(Review updated until commit 1655053)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Simplify query planner selection

Simplify query planner selection by directly using config.get_query_planner(), which
already implements the fallback logic to vlm. The conditional check and manual
fallback are now redundant.

openviking/retrieve/intent_analyzer.py [65-70]

 config = get_openviking_config()
-if hasattr(config, "get_query_planner"):
-    query_planner = config.get_query_planner()
-else:
-    query_planner = getattr(config, "query_planner", None) or config.vlm
+query_planner = config.get_query_planner()
 response = await query_planner.get_completion_async(prompt)
Suggestion importance[1-10]: 6

__

Why: The PR added OpenVikingConfig.get_query_planner() which already implements fallback to vlm, so the conditional check and manual fallback are redundant. Simplifying to directly call config.get_query_planner() makes the code cleaner and more maintainable.

Low

@heaoxiang-ai heaoxiang-ai marked this pull request as ready for review May 25, 2026 12:54
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 1655053

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant