#[cfg(feature = "_client")]
mod any_client;
pub mod client;
#[cfg(feature = "mock")]
mod fixture;
#[cfg(any(feature = "openai", feature = "anthropic", feature = "grok"))]
mod media;
mod messages;
#[cfg(feature = "mock")]
pub mod mock;
#[cfg(feature = "_client")]
mod model_macro;
#[cfg(any(feature = "openai", feature = "grok"))]
mod openai_compatible;
#[cfg(feature = "_client")]
mod request;
#[cfg(feature = "_client")]
mod routing;
#[cfg(any(
feature = "openai",
feature = "anthropic",
feature = "grok",
feature = "tools"
))]
mod schema_compatibility;
#[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};
#[cfg(feature = "mock")]
pub use fixture::{
FIXTURE_SCHEMA_VERSION, Fixture, FixtureError, FixtureRecorder, FixtureSanitizer, ReplayClient,
};
pub use messages::{ChatMessage, ChatRole};
#[cfg(feature = "_client")]
pub(crate) use messages::{MaterializeAttemptError, request_messages};
#[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 = "_client")]
pub use routing::{client, client_from_env, parse_client_spec};
#[cfg(feature = "streaming")]
pub use streaming::{ItemStream, ObjectStream, StreamedObject, TextStream};
#[cfg(feature = "tools")]
pub use tools::{DynTool, FnTool, Tool, ToolRunner, Toolbox};
pub use usage::{
AttemptKind, AttemptOutcome, AttemptRecord, Extraction, ExtractionError, ExtractionReport,
ExtractionResult, GenerateResult, MaterializeFailure, MaterializeReport, MaterializeResult,
RetryDisposition, RunUsage, TokenUsage,
};
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ModelInfo {
pub id: String,
pub name: Option<String>,
pub description: Option<String>,
}
#[cfg(feature = "anthropic")]
pub(crate) use media::{AnthropicMessageContent, build_anthropic_message_content};
#[cfg(any(feature = "openai", feature = "grok"))]
pub(crate) use media::{OpenAICompatibleMessageContent, build_openai_compatible_message_content};
#[cfg(all(feature = "streaming", any(feature = "openai", feature = "grok")))]
pub(crate) use openai_compatible::OpenAICompatibleChatMessage;
#[cfg(any(feature = "openai", feature = "grok"))]
pub(crate) use openai_compatible::{
OpenAICompatibleChatCompletionRequest, OpenAICompatibleChatCompletionResponse,
convert_openai_compatible_chat_messages,
};
#[cfg(any(
feature = "openai",
feature = "anthropic",
feature = "grok",
feature = "tools"
))]
pub(crate) use schema_compatibility::{StrictSchemaProvider, compile_strict_schema};
#[cfg(any(feature = "openai", feature = "grok"))]
pub(crate) use utils::ResponseFormat;
#[cfg(feature = "tools")]
pub(crate) use utils::check_response_status;
#[cfg(all(test, feature = "schemars"))]
pub(crate) use utils::prepare_gemini_schema;
#[cfg(feature = "_client")]
pub use utils::{DEFAULT_CONNECT_TIMEOUT, DEFAULT_REQUEST_TIMEOUT};
#[cfg(feature = "_client")]
pub(crate) use utils::{
build_http_client, check_response_status_with_capture,
generate_with_retry_attempts_with_history, generate_with_retry_attempts_with_initial_messages,
generate_with_retry_with_history, generate_with_retry_with_initial_messages, handle_http_error,
materialize_request_error, materialize_with_media_and_attempts_with_retry,
materialize_with_media_with_retry, parse_json_response, parse_validate_and_create_output,
};
#[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"),
}
}
}