-
-
Notifications
You must be signed in to change notification settings - Fork 815
Closed
Description
Summary
Severity: 🟠 HIGH
Files: 3 locations in Ollama integration
Category: Hardcoded Values - Configuration Management
Problem
Multiple Ollama providers use hardcoded dummy API key "ollama" instead of proper configuration handling.
Affected Files
1. LLM Provider
File: apps/backend/integrations/graphiti/providers_pkg/llm_providers/ollama_llm.py:49
llm_config = LLMConfig(
api_key="ollama", # Ollama requires a dummy API key
model=config.ollama_llm_model,
# ...
)2. Embedder Provider
File: apps/backend/integrations/graphiti/providers_pkg/embedder_providers/ollama_embedder.py:121
api_key="ollama", # Ollama requires a dummy API key3. Cross-Encoder
File: apps/backend/integrations/graphiti/providers_pkg/cross_encoder.py:57
api_key="ollama",Impact
- ❌ If actual API validation is enforced, authentication will fail
- ❌ Cannot customize API key via configuration
- ❌ Hardcoded values prevent environment-specific overrides
- ❌ Violates configuration management best practices
Proposed Solution
Option 1: Environment Variable (Recommended)
# In each provider
api_key = os.environ.get("OLLAMA_API_KEY", "ollama") # Default to "ollama" if not setOption 2: Configuration File
# In config
ollama_api_key: str = "ollama" # Can be overridden in config
# In provider
api_key=config.ollama_api_keyOption 3: Conditional Based on Endpoint
# Only use dummy key for local Ollama
api_key = "ollama" if base_url.startswith("http://localhost") else config.ollama_api_keyAcceptance Criteria
- All 3 hardcoded
"ollama"strings replaced with configuration - Support environment variable override
- Default to
"ollama"for backward compatibility - Document Ollama API key requirements
- Test with real Ollama installation
Priority
HIGH - Should be fixed in next sprint
References
- Mock Elimination Audit: HIGH finding Auto claude/add followup on done task #1-3
- Related docs:
test_ollama_embedding_memory.py:33mentions dummy key requirement
Metadata
Metadata
Assignees
Labels
No labels