klieo_llm_openai/lib.rs
1#![deny(missing_docs)]
2#![deny(rust_2018_idioms)]
3#![deny(rustdoc::broken_intra_doc_links)]
4
5//! OpenAI Chat Completions client implementing [`klieo_core::LlmClient`].
6//!
7//! Wraps OpenAI's `/v1/chat/completions` and `/v1/embeddings` endpoints.
8//! Capability declaration (`tool_calling`, `streaming`, `structured_output`,
9//! `embeddings`, `max_context_tokens`) is computed at construction time from
10//! the configured chat-model name; see [`capabilities::model_capabilities`].
11//!
12//! Sibling to `klieo_llm_ollama` — the two crates implement the same
13//! `LlmClient` trait so a `Box<dyn LlmClient>` consumer can swap between
14//! them without other code changes.
15//!
16//! # Example
17//!
18//! ```no_run
19//! use klieo_llm_openai::OpenAiClient;
20//! let client = OpenAiClient::new("sk-...", "gpt-4o-mini");
21//! # let _ = client;
22//! ```
23//!
24//! # Limitations
25//!
26//! - Vision input is not supported (the `vision` capability is always
27//! `false`); `gpt-4o`'s image messages require a `Message::content`
28//! change in `klieo-core` first.
29//! - Azure OpenAI and OpenRouter are not yet first-class targets;
30//! override the base URL via [`OpenAiClient::with_base_url`] for now.
31
32pub mod capabilities;
33pub use capabilities::model_capabilities;
34
35pub(crate) mod error;
36pub(crate) mod stream;
37pub(crate) mod wire;
38
39pub mod client;
40pub use client::OpenAiClient;