merge: merge yc into qyqy_develop

This commit is contained in:
2026-09-12 12:50:14 +08:00
18 changed files with 465 additions and 55 deletions
+7 -3
View File
@@ -2,7 +2,7 @@ import logging
import os
from collections.abc import Mapping
from dataclasses import dataclass
from typing import Any, Protocol
from typing import Any, Protocol, cast
import httpx
from sqlalchemy import select
@@ -183,14 +183,18 @@ class DatabaseModelGateway:
async def generate(self, *, endpoint_code: str, prompt: str, timeout_ms: int) -> str:
endpoint = await self._endpoint(endpoint_code)
adapter = OpenAICompatibleGateway({endpoint.endpoint_code: endpoint})
adapter = OpenAICompatibleGateway(
{endpoint.endpoint_code: cast(EndpointSettings, endpoint)}
)
return await adapter.generate(
endpoint_code=endpoint.endpoint_code, prompt=prompt, timeout_ms=timeout_ms
)
async def embed(self, *, endpoint_code: str, text: str, timeout_ms: int) -> list[float]:
endpoint = await self._endpoint(endpoint_code)
adapter = OpenAICompatibleGateway({endpoint.endpoint_code: endpoint})
adapter = OpenAICompatibleGateway(
{endpoint.endpoint_code: cast(EndpointSettings, endpoint)}
)
return await adapter.embed(
endpoint_code=endpoint.endpoint_code, text=text, timeout_ms=timeout_ms
)