File size: 852 Bytes
08fd094
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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")),
        )
    )