This commit introduces a comprehensive configuration system that makes Graphiti more flexible and easier to configure across different providers and deployment environments. ## New Features - **Unified Configuration**: New GraphitiConfig class with Pydantic validation - **YAML Support**: Load configuration from .graphiti.yaml files - **Multi-Provider Support**: Easy switching between OpenAI, Azure, Anthropic, Gemini, Groq, and LiteLLM - **LiteLLM Integration**: Unified access to 100+ LLM providers - **Factory Functions**: Automatic client creation from configuration - **Full Backward Compatibility**: Existing code continues to work ## Configuration System - graphiti_core/config/settings.py: Pydantic configuration classes - graphiti_core/config/providers.py: Provider enumerations and defaults - graphiti_core/config/factory.py: Factory functions for client creation ## LiteLLM Client - graphiti_core/llm_client/litellm_client.py: New unified LLM client - Support for Azure OpenAI, AWS Bedrock, Vertex AI, Ollama, vLLM, etc. - Automatic structured output detection ## Documentation - docs/CONFIGURATION.md: Comprehensive configuration guide - examples/graphiti_config_example.yaml: Example configurations - DOMAIN_AGNOSTIC_IMPROVEMENT_PLAN.md: Future improvement roadmap ## Tests - tests/config/test_settings.py: 22 tests for configuration - tests/config/test_factory.py: 12 tests for factories - 33/34 tests passing (97%) ## Issues Addressed - #1004: Azure OpenAI support - #1006: Azure OpenAI reranker support - #1007: vLLM/OpenAI-compatible provider stability - #1074: Ollama embeddings support - #995: Docker Azure OpenAI support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
100 lines
2.5 KiB
Python
100 lines
2.5 KiB
Python
"""
|
|
Copyright 2024, Zep Software, Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
"""
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class LLMProvider(str, Enum):
|
|
"""Supported LLM providers for Graphiti."""
|
|
|
|
OPENAI = 'openai'
|
|
AZURE_OPENAI = 'azure_openai'
|
|
ANTHROPIC = 'anthropic'
|
|
GEMINI = 'gemini'
|
|
GROQ = 'groq'
|
|
LITELLM = 'litellm' # Unified interface for multiple providers
|
|
CUSTOM = 'custom'
|
|
|
|
|
|
class EmbedderProvider(str, Enum):
|
|
"""Supported embedding providers for Graphiti."""
|
|
|
|
OPENAI = 'openai'
|
|
AZURE_OPENAI = 'azure_openai'
|
|
VOYAGE = 'voyage'
|
|
GEMINI = 'gemini'
|
|
CUSTOM = 'custom'
|
|
|
|
|
|
class DatabaseProvider(str, Enum):
|
|
"""Supported graph database providers for Graphiti."""
|
|
|
|
NEO4J = 'neo4j'
|
|
FALKORDB = 'falkordb'
|
|
NEPTUNE = 'neptune'
|
|
CUSTOM = 'custom'
|
|
|
|
|
|
class RerankerProvider(str, Enum):
|
|
"""Supported reranker providers for Graphiti."""
|
|
|
|
OPENAI = 'openai'
|
|
AZURE_OPENAI = 'azure_openai'
|
|
CUSTOM = 'custom'
|
|
|
|
|
|
# Provider-specific default models
|
|
DEFAULT_MODELS = {
|
|
LLMProvider.OPENAI: {
|
|
'model': 'gpt-4.1-mini',
|
|
'small_model': 'gpt-4.1-nano',
|
|
},
|
|
LLMProvider.AZURE_OPENAI: {
|
|
'model': 'gpt-4.1-mini',
|
|
'small_model': 'gpt-4.1-nano',
|
|
},
|
|
LLMProvider.ANTHROPIC: {
|
|
'model': 'claude-sonnet-4-5-latest',
|
|
'small_model': 'claude-haiku-4-5-latest',
|
|
},
|
|
LLMProvider.GEMINI: {
|
|
'model': 'gemini-2.5-flash',
|
|
'small_model': 'gemini-2.5-flash',
|
|
},
|
|
LLMProvider.GROQ: {
|
|
'model': 'llama-3.1-70b-versatile',
|
|
'small_model': 'llama-3.1-8b-instant',
|
|
},
|
|
}
|
|
|
|
DEFAULT_EMBEDDINGS = {
|
|
EmbedderProvider.OPENAI: {
|
|
'model': 'text-embedding-3-small',
|
|
'dimensions': 1536,
|
|
},
|
|
EmbedderProvider.AZURE_OPENAI: {
|
|
'model': 'text-embedding-3-small',
|
|
'dimensions': 1536,
|
|
},
|
|
EmbedderProvider.VOYAGE: {
|
|
'model': 'voyage-3',
|
|
'dimensions': 1024,
|
|
},
|
|
EmbedderProvider.GEMINI: {
|
|
'model': 'text-embedding-004',
|
|
'dimensions': 768,
|
|
},
|
|
}
|