Skip to main content

Crate klieo_llm_common

Crate klieo_llm_common 

Source
Expand description

Provider-agnostic plumbing shared by every klieo-llm-* provider crate.

The Anthropic, OpenAI, Gemini, and Ollama clients all duplicated the same HTTP-client builder and the same reqwest::ErrorLlmError mapping. A tuning change had to land in four files; security defaults (TLS redirect policy, connect timeout) could silently drift between providers.

This crate centralises:

SSE-event decoding is NOT shared: the frame splitter itself is five lines per crate, and the per-provider event dispatch loop sitting on top is genuinely different (Anthropic typed events, OpenAI choices deltas, Gemini candidates, Ollama JSON-per-line). Sharing the splitter alone would add an abstraction without removing the bulk.

Re-exports§

pub use crate::error::map_reqwest;
pub use crate::error::map_status_code;
pub use crate::error::retry_after_from_headers;
pub use crate::error::truncate_error_detail;
pub use crate::error::StatusMessageKind;
pub use crate::http::build_http_client;
pub use crate::http::HttpDefaults;
pub use crate::http::DEFAULT_HTTP_DEFAULTS;

Modules§

error
Shared error-mapping helpers used by every LLM provider crate.
http
HTTP-client factory shared by every LLM provider crate.