#[cfg(feature = "_client")]
mod any_client;
pub mod client;
#[cfg(feature = "_client")]
mod media;
mod messages;
#[cfg(feature = "mock")]
pub mod mock;
#[cfg(feature = "_client")]
mod model_macro;
#[cfg(feature = "_client")]
mod openai_compatible;
#[cfg(feature = "_client")]
mod request;
#[cfg(feature = "streaming")]
pub mod streaming;
#[cfg(feature = "tools")]
pub mod tools;
pub mod usage;
#[cfg(feature = "_client")]
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;
#[cfg(feature = "_client")]
pub use any_client::{AnyClient, Provider};
pub use client::{LLMClient, MediaFile};
pub use messages::{ChatMessage, ChatRole};
#[cfg(feature = "_client")]
pub use messages::{MaterializeInternalOutput, ValidationFailureContext};
#[cfg(feature = "mock")]
pub use mock::{MockClient, MockRequestView, MockResponse, RecordedRequest, RequestKind};
#[cfg(feature = "_client")]
pub use request::{Request, RequestExt};
#[cfg(feature = "streaming")]
pub use streaming::{ItemStream, ObjectStream, StreamedObject, TextStream};
#[cfg(feature = "tools")]
pub use tools::{DynTool, FnTool, Tool, ToolRunner, Toolbox};
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>,
}
#[cfg(feature = "_client")]
pub(crate) use media::{
AnthropicMessageContent, OpenAICompatibleMessageContent, build_anthropic_message_content,
build_openai_compatible_message_content,
};
#[cfg(feature = "streaming")]
pub(crate) use openai_compatible::OpenAICompatibleChatMessage;
#[cfg(feature = "_client")]
pub(crate) use openai_compatible::{
OpenAICompatibleChatCompletionRequest, OpenAICompatibleChatCompletionResponse,
convert_openai_compatible_chat_messages,
};
#[cfg(feature = "_client")]
pub use utils::{DEFAULT_CONNECT_TIMEOUT, DEFAULT_REQUEST_TIMEOUT};
#[cfg(feature = "_client")]
pub(crate) use utils::{
ResponseFormat, build_http_client, 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"),
}
}
}