Skip to content

feat(prompts): add optional instruction variable to semantic summary templates#1840

Open
yeyitech wants to merge 5 commits intovolcengine:mainfrom
yeyitech:feat/semantic-instruction
Open

feat(prompts): add optional instruction variable to semantic summary templates#1840
yeyitech wants to merge 5 commits intovolcengine:mainfrom
yeyitech:feat/semantic-instruction

Conversation

@yeyitech
Copy link
Copy Markdown
Contributor

@yeyitech yeyitech commented May 2, 2026

Summary

  • Add optional instruction variable to semantic.code_summary, semantic.document_summary, semantic.file_summary, and semantic.overview_generation prompt templates
  • When instruction is non-empty, it is injected into the prompt before the output requirements section, allowing domain-specific guidance (e.g. "Focus on API endpoints and return types" for SDK docs)
  • Thread instruction field through SemanticMsgSemanticProcessor._process_single_directory_generate_file_summaries_generate_single_file_summary and _generate_overview
  • Also thread instruction through SemanticDagExecutor (the recursive DAG path) so both recursive and non-recursive processing honour the custom instruction
  • Fully backward-compatible: instruction defaults to "" and the conditional block is a no-op when empty

Closes #578

Test plan

  • render_prompt("semantic.code_summary", {"file_name": "api.py", "content": "...", "instruction": ""}) — instruction block absent from output
  • render_prompt("semantic.code_summary", {"file_name": "api.py", "content": "...", "instruction": "Focus on public API surface"}) — instruction block present
  • SemanticMsg("viking://x", "resource", instruction="test").instruction == "test" passes
  • Existing tests pass (instruction defaults to empty, no behavior change)

🤖 Generated with Claude Code

yeyitech and others added 5 commits May 2, 2026 09:11
…teError (volcengine#1758)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…h embedded credentials (volcengine#1734)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mary customization (volcengine#578)

Thread a new `summary_instruction` parameter from the CLI option
`--summary-instruction` through the full pipeline: CLI command →
BaseClient/HTTPClient/LocalClient → HTTP router → ResourceService →
ResourceProcessor → TreeBuilder → SemanticMsg.instruction, so
SemanticProcessor can use it when generating per-file abstracts and
directory overviews via VLM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…templates (volcengine#578)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

578 - Fully compliant

Compliant requirements:

  • Added summary_instruction parameter threaded through the stack
  • Added instruction variable to prompt templates
  • Fully backward-compatible with defaults
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🏅 Score: 75
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: fix(vlm): explicitly disable streaming in VLM calls

Relevant files:

  • openviking/models/vlm/backends/openai_vlm.py

Sub-PR theme: feat(parse): relax repo URL normalization for all hosts

Relevant files:

  • openviking/parse/parsers/code/code.py

Sub-PR theme: fix(rerank): handle empty documents and unexpected response formats

Relevant files:

  • openviking_cli/utils/rerank.py

⚡ Recommended focus areas for review

Syntax Error

The docstring closing quote and result = { line are merged incorrectly, causing invalid Python syntax that will prevent the module from being imported.

"""        result = {

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix broken docstring termination

Fix the broken docstring termination. The triple quote was merged with the result
assignment line, turning all subsequent function code into part of the docstring.

openviking/utils/resource_processor.py [88]

-"""        result = {
+"""
+result = {
Suggestion importance[1-10]: 9

__

Why: This fixes a critical syntax error where the docstring wasn't properly terminated, which would have caused all subsequent code in the function to be treated as part of the docstring, breaking functionality entirely.

High

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.

[Feature]: 允许提示词模板自定义添加和指定

1 participant