← Back to Pull requests

feat(core): add Voyage AI embedding and reranker providers #2116

Closed
unknown closed this pull request without merging on Nov 29, 2026 16:32 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 14:12 UTC
Author

Basic Memory can embed notes and rerank search results through LiteLLM, but Voyage AI has no provider of its own: users need LiteLLM's model strings, per-model dimension settings, and no check that a model name is a real Voyage model.

This adds first-class voyage providers built on the official voyageai SDK, shipped as the optional basic-memory[voyage] extra:

  • Embeddings (semantic_embedding_provider=voyage): voyage-4-large, voyage-4, voyage-4-lite, voyage-code-4, voyage-3-large, voyage-3.5, voyage-3.5-lite, voyage-code-3, voyage-finance-2, voyage-law-2, plus the contextualized voyage-context-4 and voyage-context-3. Matryoshka models accept 2048/1024/512/256; the dimension is requested from Voyage only when semantic_embedding_dimensions is set. Chunks are embedded as document, queries as query.

  • Reranking (reranker_provider=voyage): rerank-3, rerank-3-lite, rerank-2.5, rerank-2.5-lite.

  • No default model. The model must be named; anything else (including the bge-small-en-v1.5 config default), an unsupported dimension, or a batch size outside 1–1000 fails with an error that lists the valid values. Other providers keep their defaults.

  • Requests are packed by the model's per-request token cap (1M -lite, 320K voyage-4/voyage-3.5, 120K the rest) using the SDK tokenizer, and by the 1000-input limit; if the tokenizer cannot be loaded, only the input limit applies.

  • API errors report the text of Voyage's {"detail": ...} body. VOYAGE_API_KEY (or the existing key setting) supplies the credential.

  • Contextualized models send flat one-string documents with enable_auto_chunking=true and chunk_size=32000 for indexed chunks, and no auto-chunking for queries. Basic Memory hands providers flat chunks already mixed across notes, so each chunk is its own document and gets no cross-chunk context; this is documented.
  • Docs: docs/semantic-search.md and the README rerank section.

    Tested with new unit tests for the failure modes (bad or missing model, dimensions, batch size, API-imposed contextualized constraints, malformed or failed rerank responses; 100% coverage of the new modules), and live through bm reindex and bm tool search --mode semantic with every embedding model (native, 256 and 2048 dimensions where supported) and every rerank model. just test-voyage-live runs an opt-in live check for a plain and a contextualized model.

    Diff: 305 lines (+228 / -77) across 3 files Reviewer: tonydzi Review duration: 21739m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 305 lines diff across 3 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.342
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #2116"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.2% (MEDIUM) · Higher = larger blast radius
    45.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%