Feature: llamacpp support + strict collection naming (optional)#224
Open
spumer wants to merge 4 commits intozilliztech:masterfrom
Open
Feature: llamacpp support + strict collection naming (optional)#224spumer wants to merge 4 commits intozilliztech:masterfrom
spumer wants to merge 4 commits intozilliztech:masterfrom
Conversation
- Add LlamaCppEmbedding class with OpenAI-compatible API - Support for local llama.cpp servers with nomic-embed-code model - Automatic code prefix for improved code search quality - Configurable timeout and dimension auto-detection - Integration with MCP configuration system - Environment variables: LLAMACPP_HOST, LLAMACPP_MODEL, LLAMACPP_TIMEOUT, LLAMACPP_CODE_PREFIX 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Add LlamaCpp to supported embedding providers in main README - Update environment variables documentation with LlamaCpp options - Add comprehensive LlamaCpp configuration guide to MCP README - Include setup instructions for local inference on consumer hardware - Add configuration examples for various MCP clients - Document LlamaCpp's goal: enable large model inference on Apple Silicon and desktop GPUs 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Add configurable collection naming strategy to prevent conflicts between different embedding providers and models. This ensures complete isolation when switching between providers like Ollama and LlamaCpp. ## Core Changes ### Embedding Providers - Add abstract `getModel()` method to base Embedding class - Implement `getModel()` in all providers: - OllamaEmbedding: returns config.model - LlamaCppEmbedding: returns config.model with fallback - OpenAIEmbedding: returns config.model - GeminiEmbedding: returns config.model with fallback - VoyageAIEmbedding: returns config.model ### Collection Naming - Add `EMBEDDING_STRICT_COLLECTION_NAMES` environment variable - Implement dual naming strategies in Context.getCollectionName(): - Legacy (default): `hybrid_code_chunks_<hash>` (backward compatible) - Strict: `hybrid_<provider>_<model>_<path_hash>_<unique_hash>` - Add `customCollectionName` support in ContextConfig - Ensure model names are sanitized for safe collection naming ### MCP Integration - Add `embeddingStrictCollectionNames` to ContextMcpConfig - Auto-set environment variable from MCP config - Add new variables to debug output: - MILVUS_TOKEN (shows length only for security) - MILVUS_COLLECTION_NAME - LLAMACPP_TIMEOUT - LLAMACPP_CODE_PREFIX - EMBEDDING_STRICT_COLLECTION_NAMES - Update help message with new configuration options - Add examples for strict collection naming usage ### Documentation - Update .env.example with collection naming configuration - Add comprehensive examples in MCP help text - Document all new environment variables ## Benefits - **Zero conflict risk**: Each provider+model combination gets unique collection - **Safe experimentation**: Switch providers without data contamination - **Backward compatible**: Legacy naming works by default - **Full isolation**: Ollama and LlamaCpp collections never intersect ## Example Collection Names - Ollama: `hybrid_ollama_nomic_embed_text_abc12345_def67890` - LlamaCpp: `hybrid_llamacpp_nomic_embed_code_Q4_1_gguf_abc12345_fed09876` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document new EMBEDDING_STRICT_COLLECTION_NAMES and MILVUS_COLLECTION_NAME environment variables in all relevant documentation files. ## Updated Documentation ### Environment Variables Guide - Add MILVUS_COLLECTION_NAME variable description - Add EMBEDDING_STRICT_COLLECTION_NAMES variable with detailed explanation - Add collection naming modes comparison (legacy vs strict) - Add use cases and benefits for strict mode ### MCP README - Add new "Collection Naming Configuration" section - Document both naming modes with examples - Explain format differences: `hybrid_code_chunks_<hash>` vs `hybrid_<provider>_<model>_<hash>_<unique>` - Recommend strict mode for multi-provider experimentation ## Benefits for Users - Clear understanding of collection naming behavior - Guidance on when to use strict mode - Prevention of data conflicts when switching providers - Complete reference for all configuration options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Hi. I'm testing few models and providers for my projects and make some contributions to claude-context repo.
May be this features will be usefull for your projects too.
Thanks for your work!
Below you can see description prepared by Claude Code:
🎯 Summary
Add configurable collection naming strategy to prevent data conflicts when switching between different embedding providers and models.
💡 Motivation
Currently, when users switch between embedding providers (e.g., from Ollama to LlamaCpp), all providers share the same collection name (
hybrid_code_chunks_<hash>). This causes:✨ What's New
Core Features
Strict Collection Naming Mode (opt-in via
EMBEDDING_STRICT_COLLECTION_NAMES=true)hybrid_<provider>_<model>_<path_hash>_<unique_hash>hybrid_ollama_nomic_embed_text_abc12345_def67890Custom Collection Names (via
MILVUS_COLLECTION_NAME)New
getModel()MethodEmbeddingclassBackward Compatibility
hybrid_code_chunks_<hash>) remains default🎁 Benefits
For Users
For Project