feat: use internal ollama embeddings

This commit is contained in:
2026-08-08 17:29:36 +02:00
parent 9f104171b6
commit 2911e008d1
7 changed files with 455 additions and 92 deletions
+4 -4
View File
@@ -39,16 +39,16 @@ def _installed_models(base_url: str, timeout: float = 5.0) -> set[str]:
def _start(start_cmd: list[str]) -> None:
# Detached so the server outlives this short-lived CLI process.
subprocess.Popen( # noqa: S603
subprocess.Popen(
start_cmd, start_new_session=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
def _warm(cfg) -> None:
from tht.vectorstore.embeddings import OllamaEmbeddings
from tht.vectorstore.embeddings import OllamaInternalEmbeddings
OllamaEmbeddings(cfg.embeddings).embed_query("ping")
OllamaInternalEmbeddings(cfg.embeddings).embed_query("ping")
def _model_present(installed: set[str], model: str) -> bool:
@@ -104,7 +104,7 @@ def ensure_ollama(
if probe(base_url):
up = True
break
except Exception: # noqa: BLE001 - transient during startup; keep polling
except Exception: # noqa: BLE001,S112 - transient during startup; keep polling
continue
if not up:
return {"ok": False, "stage": "server",