fix: force IPv4 voor Mistral embedding API (IPv6 timeout op Hetzner)
This commit is contained in:
parent
df8a520b87
commit
9e254cc953
1 changed files with 13 additions and 12 deletions
|
|
@ -165,7 +165,9 @@ class SemanticSearch:
|
||||||
def _get_embeddings(self, texts: list[str]) -> list[list[float]] | None:
|
def _get_embeddings(self, texts: list[str]) -> list[list[float]] | None:
|
||||||
"""Genereer embeddings via Mistral API."""
|
"""Genereer embeddings via Mistral API."""
|
||||||
try:
|
try:
|
||||||
resp = httpx.post(
|
transport = httpx.HTTPTransport(local_address="0.0.0.0")
|
||||||
|
with httpx.Client(transport=transport, timeout=30) as client:
|
||||||
|
resp = client.post(
|
||||||
MISTRAL_EMBED_URL,
|
MISTRAL_EMBED_URL,
|
||||||
headers={
|
headers={
|
||||||
"Authorization": f"Bearer {self.api_key}",
|
"Authorization": f"Bearer {self.api_key}",
|
||||||
|
|
@ -175,7 +177,6 @@ class SemanticSearch:
|
||||||
"model": MISTRAL_EMBED_MODEL,
|
"model": MISTRAL_EMBED_MODEL,
|
||||||
"input": texts,
|
"input": texts,
|
||||||
},
|
},
|
||||||
timeout=30,
|
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue