Merge pull request #41 from salestech-group/fix/37-graphiti-small-model-fallback

fix(graph): pass small_model to graphiti so non-openai backends don't 404
This commit is contained in:
Dominik Seemann 2026-05-11 13:13:26 +02:00 committed by GitHub
commit 7a713f8f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

View File

@ -64,6 +64,12 @@ Copy `.env.example` to `.env`:
LLM_API_KEY # Required
LLM_BASE_URL # Default: https://dashscope.aliyuncs.com/compatible-mode/v1
LLM_MODEL_NAME # Default: qwen-plus
LLM_SMALL_MODEL_NAME # Default: value of LLM_MODEL_NAME
# Used by Graphiti for simpler extraction prompts
# (ModelSize.small). Must exist on the same endpoint
# as LLM_MODEL_NAME — Graphiti otherwise falls back
# to its hard-coded `gpt-4.1-nano`, which 404s on
# non-OpenAI backends (Qwen, GLM, Ollama, ...).
# Neo4j + Graphiti (knowledge graph)
NEO4J_URI # Default: bolt://localhost:7687

View File

@ -33,6 +33,11 @@ class Config:
LLM_API_KEY = os.environ.get('LLM_API_KEY')
LLM_BASE_URL = os.environ.get('LLM_BASE_URL', 'https://api.openai.com/v1')
LLM_MODEL_NAME = os.environ.get('LLM_MODEL_NAME', 'gpt-4o-mini')
# Optional smaller/cheaper model used by Graphiti for simpler extraction
# prompts (ModelSize.small). Defaults to LLM_MODEL_NAME so non-OpenAI
# backends (Qwen/Dashscope, GLM, Ollama via /v1, ...) don't fall through
# to Graphiti's hard-coded `gpt-4.1-nano`, which would 404.
LLM_SMALL_MODEL_NAME = os.environ.get('LLM_SMALL_MODEL_NAME') or os.environ.get('LLM_MODEL_NAME', 'gpt-4o-mini')
# Neo4j + Graphiti settings (replacement for Zep Cloud).
NEO4J_URI = os.environ.get('NEO4J_URI', 'bolt://localhost:7687')

View File

@ -132,6 +132,7 @@ def _build_llm_and_embedder(provider: str):
api_key=Config.LLM_API_KEY,
base_url=Config.LLM_BASE_URL,
model=Config.LLM_MODEL_NAME,
small_model=Config.LLM_SMALL_MODEL_NAME,
)
)
embedder = OpenAIEmbedder(