forked from retoor/devplacepy
Update
This commit is contained in:
@@ -9,8 +9,8 @@ import re
|
||||
import time
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from devplacepy import stealth
|
||||
from devplacepy.config import INTERNAL_EMBED_MODEL, INTERNAL_EMBED_URL
|
||||
from devplacepy.services.deepsearch.llm import gateway_client
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -112,13 +112,15 @@ async def embed_texts(
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json",
|
||||
"X-App-Reference": "devplace-deepsearch-v-1-0-0",
|
||||
}
|
||||
payload = {"model": INTERNAL_EMBED_MODEL, "input": pending_text}
|
||||
start = time.monotonic()
|
||||
backend = "gateway"
|
||||
try:
|
||||
async with stealth.stealth_async_client(timeout=EMBED_TIMEOUT_SECONDS) as client:
|
||||
response = await client.post(gateway_url, json=payload, headers=headers)
|
||||
response = await gateway_client().post(
|
||||
gateway_url, json=payload, headers=headers, timeout=EMBED_TIMEOUT_SECONDS
|
||||
)
|
||||
if response.status_code >= 400:
|
||||
raise RuntimeError(f"embed gateway returned {response.status_code}")
|
||||
data = response.json()
|
||||
|
||||
Reference in New Issue
Block a user