1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//! LLM provider abstraction and integration for Bamboo.
//!
//! This module provides a unified interface for working with multiple LLM providers,
//! including Anthropic, OpenAI, Google Gemini, and GitHub Copilot.
//!
//! # Architecture
//!
//! The LLM system is organized into several layers:
//!
//! - **provider**: Core trait definition for LLM providers
//! - **providers**: Concrete implementations for each LLM service
//! - **protocol**: Request/response protocol adapters
//! - **models**: Common data models for LLM interactions
//! - **types**: Supporting types and utilities
//!
//! # Supported Providers
//!
//! - **Anthropic**: Claude models via Anthropic API
//! - **OpenAI**: GPT models via OpenAI API
//! - **Gemini**: Google's Gemini models via Vertex AI
//! - **Copilot**: GitHub Copilot integration
//!
//! # Key Concepts
//!
//! ## Provider Trait
//!
//! All LLM providers implement the [`LLMProvider`] trait, which defines:
//!
//! - Stream-based completion generation
//! - Model capability queries
//! - Configuration validation
//!
//! ## Protocol Adapters
//!
//! The protocol system handles differences between provider APIs:
//!
//! - [`AnthropicProtocol`]: Anthropic-specific request/response format
//! - [`OpenAIProtocol`]: OpenAI-compatible format
//! - [`GeminiProtocol`]: Google Gemini format
//!
//! ## Factory Functions
//!
//! Use [`create_provider`] to instantiate providers from configuration:
//!
//! ```no_run
//! use bamboo_agent::llm::create_provider;
//! use bamboo_agent::Config;
//!
//! // Typically you would load from disk; for docs we use a default config.
//! let config = Config::default();
//! let _provider = create_provider(&config);
//! ```
//!
//! # Example
//!
//! ```rust,ignore
//! use bamboo_agent::llm::{create_provider, LLMProvider};
//! use bamboo_agent::Config;
//! use futures::StreamExt;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let config = Config::default();
//! let provider = create_provider(&config)?;
//!
//! let messages = vec![]; // build provider-specific messages
//! let mut stream = provider.complete(messages).await?;
//! while let Some(chunk) = stream.next().await {
//! println!("{:?}", chunk?);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Re-exports
//!
//! Core types and functions:
//!
//! - Provider trait: [`LLMProvider`], [`LLMStream`], [`LLMError`]
//! - Protocol types: [`AnthropicProtocol`], [`OpenAIProtocol`], [`GeminiProtocol`]
//! - Factory functions: [`create_provider`], [`validate_provider_config`]
//! - Concrete providers: [`AnthropicProvider`], [`OpenAIProvider`], [`GeminiProvider`], [`CopilotProvider`]
pub
pub use crateConfig;
pub use ProxyAuthRequiredError;
pub use *;
pub use ;
pub use ;
pub use ;
pub use ;
pub use LLMChunk;