Skip to main content

agent_sdk/
llm.rs

1//! LLM provider trait, streaming types, and message data types.
2//!
3//! This module re-exports from [`agent_sdk_providers`] and [`agent_sdk_foundation`]
4//! so that existing `crate::llm::*` paths continue to resolve.
5
6// The providers crate only compiles its `attachments` module when at least
7// one provider feature is enabled (the helpers are dead code otherwise), so
8// this facade re-export must carry the matching gate.
9#[cfg(any(
10    feature = "anthropic",
11    feature = "openai",
12    feature = "openai-codex",
13    feature = "gemini",
14    feature = "vertex",
15    feature = "cloudflare",
16))]
17pub mod attachments {
18    //! Attachment validation (facade for external consumers).
19    //!
20    //! The upstream helpers are all `pub(crate)`, so this glob re-exports no
21    //! public name today; the `allow` keeps the facade shell compiling until
22    //! a `pub` item lands upstream.
23    #[allow(unused_imports)]
24    pub use agent_sdk_providers::attachments::*;
25}
26
27pub mod router {
28    //! Model routing.
29    pub use agent_sdk_providers::router::*;
30}
31
32pub mod streaming {
33    //! Streaming types.
34    pub use agent_sdk_providers::streaming::*;
35}
36
37pub mod types {
38    //! LLM data types.
39    pub use agent_sdk_foundation::llm::*;
40}
41
42// Re-export everything at the llm:: level for backward compatibility
43pub use agent_sdk_foundation::llm::*;
44pub use agent_sdk_providers::provider::{LlmProvider, collect_stream};
45pub use agent_sdk_providers::router::{ModelRouter, ModelTier, TaskComplexity};
46pub use agent_sdk_providers::streaming::{
47    StreamAccumulator, StreamBox, StreamDelta, StreamErrorKind,
48};