feat(semantic_search): make embedding model configurable (#22)
google/gemini-embedding-001 became paid on OpenRouter, leaving users without credit unable to run the semantic_search tool. The old code hardcoded the model and 3072 dimensions in three places. Make OpenRouterEmbedder accept model/dimension via constructor args or OPENROUTER_EMBEDDING_MODEL / OPENROUTER_EMBEDDING_DIMENSION env vars, with the previous values as backward-compatible defaults. Switch the VectorStore and the response payload in mcp_server_main to read embedder.dimension instead of the hardcoded 3072 so a configured non-Gemini model does not produce shape mismatches. Bad dimension input (non-int or non-positive) now raises a clear ValueError instead of a downstream shape error. Documented the new env vars in .env.example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ae5d590cca
commit
42731a2c03
@@ -79,6 +79,13 @@ JWT_SECRET_KEY=your_jwt_secret_key_here
|
||||
# If not set, semantic search tool will be disabled
|
||||
OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
|
||||
|
||||
# Optional: override the embedding model and dimension.
|
||||
# Defaults: google/gemini-embedding-001 at 3072 dims (paid on OpenRouter).
|
||||
# Pick any embedding model from https://openrouter.ai/models?modality=embedding
|
||||
# and set the dimension to that model's output size — they must match.
|
||||
# OPENROUTER_EMBEDDING_MODEL=google/gemini-embedding-001
|
||||
# OPENROUTER_EMBEDDING_DIMENSION=3072
|
||||
|
||||
# =============================================================================
|
||||
# USAGE INSTRUCTIONS
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user