classifiers.update_tool_embeddings module
Incrementally update tool embeddings in Redis.
Discovers all registered tools, compares against what already exists in Redis, generates synthetic queries for missing tools via the Gemini API (using the shared embedding key pool), and adds only the new embeddings – without touching existing ones.
Usage:
python -m classifiers.update_tool_embeddings [--force-index] [--tools-dir tools]
- Environment variables:
REDIS_URL – defaults to redis://localhost:6379/0
- async classifiers.update_tool_embeddings.get_existing_redis_tools(redis_client)[source]
Return tool names already in Redis.
- classifiers.update_tool_embeddings.discover_tools(tools_dir='tools')[source]
Auto-discover all registered tools keyed by name.
- classifiers.update_tool_embeddings.load_index_file()[source]
Load index file from the configured source.
- async classifiers.update_tool_embeddings.compute_tool_embedding(embedding_client, synthetic_queries, tool_name)[source]
Compute a normalised centroid from queries.