pub mod client;
mod media;
mod messages;
mod openai_compatible;
pub mod usage;
mod utils;
#[cfg(feature = "anthropic")]
pub mod anthropic;
#[cfg(feature = "gemini")]
pub mod gemini;
#[cfg(feature = "grok")]
pub mod grok;
#[cfg(feature = "openai")]
pub mod openai;
pub use client::{LLMClient, MediaFile};
pub use messages::{ChatMessage, ChatRole, MaterializeInternalOutput, ValidationFailureContext};
pub use usage::{GenerateResult, MaterializeResult, TokenUsage};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ModelInfo {
pub id: String,
pub name: Option<String>,
pub description: Option<String>,
}
pub(crate) use media::{
AnthropicMessageContent, OpenAICompatibleMessageContent, build_anthropic_message_content,
build_openai_compatible_message_content,
};
pub(crate) use openai_compatible::{
OpenAICompatibleChatCompletionRequest, OpenAICompatibleChatCompletionResponse,
OpenAICompatibleChatMessage, convert_openai_compatible_chat_messages,
};
pub(crate) use utils::{
ResponseFormat, check_response_status, generate_with_retry_with_history, handle_http_error,
materialize_with_media_with_retry, parse_validate_and_create_output, prepare_strict_schema,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ThinkingLevel {
Off,
Minimal,
#[default]
Low,
Medium,
High,
}
impl ThinkingLevel {
pub fn gemini_level(&self) -> Option<&'static str> {
match self {
ThinkingLevel::Off => None,
ThinkingLevel::Minimal => Some("minimal"),
ThinkingLevel::Low => Some("low"),
ThinkingLevel::Medium => Some("medium"),
ThinkingLevel::High => Some("high"),
}
}
pub fn claude_thinking_enabled(&self) -> bool {
!matches!(self, ThinkingLevel::Off)
}
pub fn claude_budget_tokens(&self) -> u32 {
match self {
ThinkingLevel::Off => 0,
ThinkingLevel::Minimal => 1024,
ThinkingLevel::Low => 2048,
ThinkingLevel::Medium => 4096,
ThinkingLevel::High => 8192,
}
}
pub fn openai_reasoning_effort(&self) -> Option<&'static str> {
match self {
ThinkingLevel::Off => Some("none"),
ThinkingLevel::Minimal => Some("low"),
ThinkingLevel::Low => Some("low"),
ThinkingLevel::Medium => Some("medium"),
ThinkingLevel::High => Some("high"),
}
}
}