| from __future__ import annotations |
|
|
| import sys |
| from functools import lru_cache |
| from pathlib import Path |
|
|
| _shared = Path(__file__).resolve().parents[4] / "shared" |
| if str(_shared) not in sys.path: |
| sys.path.insert(0, str(_shared)) |
|
|
| from ollama_client.client import OllamaClient, OllamaSettings |
|
|
|
|
| @lru_cache |
| def get_chunking_ollama() -> OllamaClient: |
| import os |
|
|
| return OllamaClient( |
| OllamaSettings( |
| enabled=os.getenv("OLLAMA_ENABLED", "true").lower() in {"1", "true", "yes"}, |
| base_url=os.getenv("OLLAMA_BASE_URL", "http://localhost:11434"), |
| embedding_model=os.getenv("OLLAMA_EMBEDDING_MODEL", "qwen3-embedding:8b"), |
| generation_model=os.getenv("OLLAMA_GENERATION_MODEL", "qwen3.5:9b"), |
| request_timeout_seconds=float(os.getenv("OLLAMA_TIMEOUT_SECONDS", "120")), |
| ) |
| ) |
|
|