Skip to main content

Crate turul_llm_openai

Crate turul_llm_openai 

Source
Expand description

OpenAI-compatible adapter for turul_llm_core::LlmClient.

Targets the chat completions API at {base_url}/chat/completions with a Bearer-token Authorization header. The base_url is configurable so this adapter also works against OpenAI-compatible gateways (Together.ai, vLLM, Groq, etc.); the default points at https://api.openai.com/v1.

Structured output uses response_format = { type: "json_schema", json_schema: { name, schema, strict } } — the official structured output path. The adapter sets strict: true so the model is held to the schema and surfaces a LlmError::SchemaViolation when the returned content still fails to parse as JSON.

Tests are wiremock-backed; live calls would require OPENAI_API_KEY and are out of scope for the default workflow.

Structs§

OpenAiClient
Client targeting an OpenAI-compatible /chat/completions endpoint.