-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(llm): llama.cpp come motore predefinito per estrazione ed embedding #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,11 +119,18 @@ services: | |
| dockerfile: Dockerfile | ||
| ports: | ||
| - "8000:8000" | ||
| # OLLAMA_BASE_URL is read from .env: | ||
| # Default engine: the self-hosted llama.cpp server on the host, reached via | ||
| # host.docker.internal — chat on :8080 (llama-swap), embeddings on :8081. | ||
| # Both are read from .env (LLAMACPP_BASE_URL / LLAMACPP_EMBEDDING_BASE_URL). | ||
|
Comment on lines
+122
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When users follow the documented quick start ( Useful? React with 👍 / 👎. |
||
| # | ||
| # OLLAMA_BASE_URL only matters with KG_LLM_PROVIDER/EMBEDDING_PROVIDER=ollama: | ||
| # default prod → http://host.docker.internal:11434 (Ollama on host) | ||
| # profile gpu → http://ollama-gpu:11434 | ||
| # profile cpu → http://ollama-cpu:11434 | ||
| env_file: .env | ||
| # host.docker.internal is not resolvable on Linux without this. | ||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" | ||
| depends_on: | ||
| neo4j: | ||
| condition: service_healthy | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,40 @@ class Settings(BaseSettings): | |
| # Redis (Vector Store) | ||
| REDIS_URL: str = "redis://localhost:6379" | ||
| REDIS_INDEX_NAME: str = "kg_vectors" | ||
| REDIS_VECTOR_DIM: int = 768 | ||
| # Must match the output width of EMBEDDING_PROVIDER's model: | ||
| # llamacpp + Qwen3-Embedding-0.6B → 1024 (measured, not declared) | ||
| # ollama + nomic-embed-text → 768 | ||
| # Changing this invalidates an existing index — see RedisVectorStore.create_index, | ||
| # which refuses to run against an index built at a different width. | ||
| REDIS_VECTOR_DIM: int = 1024 | ||
|
|
||
| # LLM provider selection for the extraction stage. | ||
| # "ollama" (default) keeps the legacy local-inference behaviour. | ||
| # "anthropic" routes extraction to Claude (Haiku by default). | ||
| # Embeddings always go to Ollama regardless of this setting. | ||
| KG_LLM_PROVIDER: str = "ollama" | ||
| # "llamacpp" (default) → the self-hosted llama.cpp inference server. | ||
| # "ollama" → the legacy local-inference behaviour. | ||
| # "anthropic" → Claude (Haiku by default), opt-in. | ||
| KG_LLM_PROVIDER: str = "llamacpp" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With this new default, Useful? React with 👍 / 👎. |
||
|
|
||
| # Embeddings are selected separately from extraction: they are the one | ||
| # thing that cannot be swapped freely, because the vector index is sized | ||
| # to the model's output width. | ||
| # "llamacpp" (default) or "ollama". | ||
| EMBEDDING_PROVIDER: str = "llamacpp" | ||
|
|
||
| # llama.cpp / llama-swap — OpenAI-compatible, self-hosted. | ||
| # Chat and embeddings are two separate servers on purpose: embeddings must | ||
| # answer in milliseconds and cannot sit behind a model swap that takes | ||
| # minutes. | ||
| LLAMACPP_BASE_URL: str = "http://localhost:8080" | ||
| LLAMACPP_LLM_MODEL: str = "qwen3.5-9b" | ||
| # Empty → falls back to LLAMACPP_LLM_MODEL. | ||
| LLAMACPP_EXTRACTION_MODEL: str = "" | ||
| LLAMACPP_EMBEDDING_BASE_URL: str = "http://localhost:8081" | ||
| LLAMACPP_EMBEDDING_MODEL: str = "qwen3-embedding" | ||
| # Set only if llama-server was started with --api-key. | ||
| LLAMACPP_API_KEY: str = "" | ||
| # A request arriving mid-swap waits for the load to finish; the 17.7 GB | ||
| # batch model needs ~2 minutes from spinning disk just to reach VRAM. | ||
| LLAMACPP_TIMEOUT_SECONDS: float = 600.0 | ||
|
|
||
| # Ollama (Inference API locale) | ||
| OLLAMA_BASE_URL: str = "http://localhost:11434" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the full production stack is run with the documented host llama.cpp server, this default collides with the MCP service: both compose files publish MCP as host
8080:8080, while llama.cpp is also expected to listen on host port 8080. Consequently either llama.cpp prevents the MCP container from binding or MCP occupies the address intended for chat completions. Assign one service a distinct host port and updateLLAMACPP_BASE_URLconsistently.Useful? React with 👍 / 👎.