feat: use internal ollama embeddings
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user