Repository navigation
Add codebase embeddings and reranking endpoints - #105
Merged
Merged
Conversation
- Route embeddings through the codebase service with BGE-M3 and Qwen aliases, bounded paid fallback, account-aware failover and usage handling. - Expose the fixed codebase reranker without unverified relevance scores, including model catalog, management and WebUI metadata. - Add preview simulations, English/Chinese client documentation and offline regression coverage. Tests: - uv run python -B -m pytest -q tests/test_embeddings.py tests/test_rerank.py tests/test_preview.py tests/test_observability.py tests/test_region_routing.py - cd web && vp check
|
Sorry @maiphucgiang, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 1 day and 3 hours by commenting |
Reviewer's GuideThis PR adds domestic codebase-backed Sequence diagram for codebase embeddings with bounded fallbacksequenceDiagram
participant Client
participant Gateway
participant AccountPool
participant Codebase
participant PaidEmbeddings
Client->>Gateway: POST /v1/embeddings
Gateway->>Gateway: request_body(payload, model)
Gateway->>AccountPool: _embedding_cred_for(model)
AccountPool-->>Gateway: credential and headers
Gateway->>Codebase: POST /codebase/openai/v1/embeddings
alt codebase route unavailable for bge-m3
Gateway->>PaidEmbeddings: POST /v2/embeddings
PaidEmbeddings-->>Gateway: vectors and usage
else route succeeds
Codebase-->>Gateway: vectors and usage
end
Gateway->>Gateway: parse_reply(payload, model, encoding, expected_count)
Gateway-->>Client: 1024-dimensional OpenAI-compatible vectors
Sequence diagram for codebase rerankingsequenceDiagram
participant Client
participant Gateway
participant AccountPool
participant Codebase
Client->>Gateway: POST /v1/rerank
Gateway->>Gateway: request_body(payload)
Gateway->>AccountPool: _embedding_cred_for(model, kind=rerank)
AccountPool-->>Gateway: credential and headers
Gateway->>Codebase: POST /codebase/openai/v1/rerank
Codebase-->>Gateway: ordered result indices
Gateway->>Gateway: parse_reply(payload, documents, top_n, return_documents)
Gateway-->>Client: ranked indices and optional documents
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/v1/embeddingsbacked by the domestic codebase service, exposing BGE-M3 and Qwen embedding aliases with 1024-dimensional float/base64 output./v1/rerankfor the fixed codebase reranker without exposing unverified relevance scores, plus model catalog, management and WebUI metadata.Tests
for s in tests/test_*.py; do uv run python -B "$s"; done— 2474 passed, 2 skipped, 5576 subtests passed.uv run python -B -m pytest -q tests/test_embeddings.py tests/test_rerank.py tests/test_preview.py tests/test_observability.py tests/test_region_routing.py— 205 passed, 365 subtests passed.cd web && vp check— formatting, lint and type checks passed.git diff --check— passed.Summary by Sourcery
Expose codebase embedding and reranking capabilities through OpenAI-compatible APIs with managed routing, catalog integration, documentation, and regression coverage.
New Features:
Enhancements:
Documentation:
Tests: