Skip to content

feat: file_search tool support with Files & Vector Stores APIs#22

Closed
franciscojavierarceo wants to merge 12 commits into
mainfrom
file-search-tool
Closed

feat: file_search tool support with Files & Vector Stores APIs#22
franciscojavierarceo wants to merge 12 commits into
mainfrom
file-search-tool

Conversation

@franciscojavierarceo
Copy link
Copy Markdown
Collaborator

Summary

Adds file_search tool support to the Responses API, backed by sqlite-vec (vector), FTS5 (keyword), and hybrid search with RRF/weighted reranking. Embeddings are generated via the upstream vLLM /v1/embeddings endpoint.

Note: This is a draft — we may instead integrate OGX's existing file_search implementation rather than maintaining a separate one here. OGX already implements prompts, conversations, and file_search with a battle-tested retrieval stack.

Depends on: #21 (responses-flow)

Commit 1: Files API + Vector Stores API

  • Files API — upload, list, get, delete, content retrieval (POST /v1/files, etc.)
  • Vector Stores API — store CRUD, file attachment with token-based chunking, search with three modes (POST /v1/vector_stores, etc.)
  • sqlite-vec with native metadata columns for predicate pushdown during k-NN traversal
  • FTS5/BM25 for keyword search
  • Reciprocal Rank Fusion and weighted reranking for hybrid search
  • Async embedding client for /v1/embeddings
  • Token-based text chunking via tiktoken

Commit 2: file_search integration with Responses API

  • FileSearchExecutor executes file_search tool calls against VectorStoreManager
  • FileSearchTool / FileSearchToolCall added to ResponsesTool / OutputItem type unions
  • Engine creates a pydantic_ai FunctionToolset when file_search is in the request tools
  • vector_store_manager wired through router → engine

Test plan

  • 24 new unit tests covering chunker, ranker, file store, vector search (sqlite-vec + FTS5), and file_search executor
  • All 124 tests pass (100 existing + 24 new)
  • ruff check and ruff format clean

🤖 Generated with Claude Code

maralbahari and others added 12 commits April 14, 2026 05:55
Signed-off-by: maral <maralbahari.98@gmail.com>
Co-authored-by: Tan Jia Huei tanjiahuei@gmail.com
Co-authored-by: noobHappylife aratar1991@hotmail.com
Co-authored-by: Claude
Signed-off-by: maralbahari maralbahari.98@gmail.com
Signed-off-by: maral <maralbahari.98@gmail.com>
Co-authored-by: Claude
Signed-off-by: maralbahari maralbahari.98@gmail.com
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Co-authored-by: Claude
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Add file upload/management (Files API) and vector store CRUD with
hybrid search (Vector Stores API). Search supports vector (sqlite-vec
with native predicate pushdown), keyword (FTS5/BM25), and hybrid
(RRF/weighted reranking) modes. Embeddings are generated via an
external vLLM /v1/embeddings endpoint.

New components:
- Files API: upload, list, get, delete, content retrieval
- Vector Stores API: store CRUD, file attachment with chunking,
  search with three modes
- Token-based text chunking (tiktoken)
- Embedding client (async httpx)
- sqlite-vec + FTS5 search tables with predicate pushdown
- RRF and weighted score fusion for hybrid search

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Connect vector stores to the engine so the model can call file_search
as a tool during a response. When a request includes a FileSearchTool
in its tools list, the engine creates a pydantic_ai FunctionToolset
with a file_search function that queries the configured vector stores
via VectorStoreManager and returns ranked results as JSON.

Changes:
- Add FileSearchExecutor (core/file_search.py)
- Add FileSearchTool and FileSearchToolCall to ResponsesTool/OutputItem
  unions in types/responses.py
- Wire vector_store_manager through Engine and responses router
- Unit tests for FileSearchExecutor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Copy link
Copy Markdown
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given our recent direction to move to rust, i believe this should be closed.

@franciscojavierarceo
Copy link
Copy Markdown
Collaborator Author

@leseb agreed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants