caelum0x 4847e35451 OpenJev: open-source typed decision service
Typed decision/classification service with an in-process gte-small ONNX
embedding engine and lexical fallback, JS/Python SDKs, adapters, and the
otsone model family. Apache-2.0 (sub-packages keep their MIT licenses).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:12:36 +03:00

31 lines
1.8 KiB
Python

import httpx2
from tenacity import AsyncRetrying, Retrying
from typing_extensions import assert_type
from openjev import AsyncTypeSafeClient, ListModelsResponse, Noul, SystemOneResponse, TypeSafeClient
from openjev._core.config import Config
from openjev._core.endpoints import prepare_models, prepare_system_one
from openjev._core.transport import Request, RequestState, send, send_async
def sync(config: Config, client: TypeSafeClient, http_client: httpx2.Client, retry: Retrying, response: httpx2.Response) -> None:
models = prepare_models(config, None, None)
system_one = prepare_system_one(config, "x", {"q": Noul(instructions="?")}, None, None, None, None, SystemOneResponse)
assert_type(models, Request[ListModelsResponse])
assert_type(system_one, Request[SystemOneResponse])
assert_type(RequestState(models).parse(response), ListModelsResponse)
assert_type(RequestState(system_one).parse(response), SystemOneResponse)
assert_type(send(http_client, retry, models), ListModelsResponse)
assert_type(send(http_client, retry, system_one), SystemOneResponse)
assert_type(client._request(models), ListModelsResponse)
assert_type(client._request(system_one), SystemOneResponse)
async def asynchronous(config: Config, client: AsyncTypeSafeClient, http_client: httpx2.AsyncClient, retry: AsyncRetrying) -> None:
models = prepare_models(config, None, None)
system_one = prepare_system_one(config, "x", {"q": Noul(instructions="?")}, None, None, None, None, SystemOneResponse)
assert_type(await send_async(http_client, retry, models), ListModelsResponse)
assert_type(await send_async(http_client, retry, system_one), SystemOneResponse)
assert_type(await client._request(models), ListModelsResponse)
assert_type(await client._request(system_one), SystemOneResponse)