openai_compat_engines
openai_compat_engines
¶
Data-driven registration of OpenAI-compatible inference engines.
Classes¶
OpenAICompatEngine
¶
OpenAICompatEngine(
host: str | None = None,
*,
api_key: str | None = None,
timeout: float = 600.0,
)
Bases: _OpenAICompatibleEngine
Generic engine for an explicitly-provided OpenAI-compatible endpoint.
Deliberately NOT registered in EngineRegistry: it is only ever
constructed with an explicit host (e.g. diapason eval --base-url), so
registering it would just add a useless localhost discovery probe and
interact with the per-test registry wipe.
Source code in src/diapason/engine/_openai_compat.py
Functions:¶
normalize_openai_base_url
¶
Strip a single trailing /v1 segment from a user-supplied base URL.
Users habitually pass http://host:8000/v1 (the full OpenAI-compatible
prefix); the engine's _api_prefix re-appends /v1 to every request
path, so a trailing copy would double up as /v1/v1. Only a literal
trailing /v1 is stripped — proxy/gateway path prefixes are preserved.