Skip to content

fix: add mode field to FindRequest and thread it through to retrieval#2347

Open
mvanhorn wants to merge 1 commit into
volcengine:mainfrom
mvanhorn:fix/2256-findrequest-mode-field
Open

fix: add mode field to FindRequest and thread it through to retrieval#2347
mvanhorn wants to merge 1 commit into
volcengine:mainfrom
mvanhorn:fix/2256-findrequest-mode-field

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Description

The /api/v1/search/find endpoint advertises a mode parameter (auto/fast/deep) in client tool schemas, but FindRequest had no mode field. Because Pydantic defaults to extra='ignore', a client-supplied mode was silently dropped before reaching service.search.find() / VikingFS.find(), even though HierarchicalRetriever already has an internal RetrieverMode that gates rerank.

This adds a validated mode field and threads it through to retrieval, so callers can control rerank cost.

Related Issue

Fixes #2256

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Add a validated mode field (auto/fast/deep, default auto) to FindRequest.
  • Map the request mode to the existing RetrieverMode (fast -> QUICK to skip rerank, deep -> THINKING to force it) and thread it through service.search.find() and VikingFS.find() to HierarchicalRetriever.
  • Forward the mode only when it is non-auto, so auto preserves today's exact behavior and existing callers are unaffected.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Tests cover request-mode validation/mapping, the auto default no-op, service pass-through, and retriever pass-through (tests/misc/test_vikingfs_find_without_rerank.py, 10 passed).

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

auto forwards no mode, so the retriever's default behavior is unchanged for existing callers. The RetrieverMode import is local to the mapping helper to avoid a module-level dependency from the router on the retriever package.

The /api/v1/search/find endpoint advertised a mode parameter (auto/fast/deep)
in client tool schemas, but FindRequest had no mode field, so Pydantic's
extra='ignore' silently dropped any client-supplied mode before it reached
retrieval.

Add a validated mode field (default auto) and translate it to the existing
RetrieverMode: auto preserves current behavior (no mode forwarded), fast maps
to QUICK to skip rerank, and deep maps to THINKING to force it. The mode is
threaded through service.search.find() and VikingFS.find() only when non-auto,
so existing callers are unaffected.

Fixes volcengine#2256
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2256 - Partially compliant

Compliant requirements:

  • Added mode field to FindRequest with default "auto"
  • Implemented mapping from request mode to RetrieverMode
  • Threaded mode through service/search.find(), VikingFS.find(), and retriever.retrieve()
  • Preserved existing behavior for "auto" mode
  • Added comprehensive tests for validation and pass-through

Non-compliant requirements:

  • No requirements left unfulfilled

Requires further human verification:

  • No items require further human verification
⏱️ 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 ✨

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.

api/v1/search/find: FindRequest has no mode field, client mode parameter silently dropped

1 participant