Skip to content

openai_compat_engines

diapason.engine.openai_compat_engines

Data-driven registration of OpenAI-compatible inference engines.

OpenAICompatEngine

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.

normalize_openai_base_url(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.