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
116
117
118
119
120
121
122
123
124
//! # Edgee Rust SDK
//!
//! A Rust SDK for the [Edgee AI Gateway](https://www.edgee.ai).
//!
//! This SDK provides a simple, idiomatic Rust interface for interacting with the Edgee AI Gateway,
//! which supports multiple LLM providers including OpenAI, Anthropic, Mistral, and more.
//!
//! ## Features
//!
//! - **Async/await support** - Built on tokio for efficient async operations
//! - **Type-safe** - Strong typing with Rust enums and structs
//! - **Streaming** - Full support for streaming responses
//! - **Tool calling** - Support for function/tool calling
//! - **Flexible input** - Accept strings, message arrays, or structured objects
//! - **Error handling** - Comprehensive error types with `thiserror`
//! - **Zero-cost abstractions** - Efficient implementation with minimal overhead
//!
//! ## Quick Start
//!
//! ```no_run
//! use edgee::Edgee;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create client from environment variables (EDGEE_API_KEY)
//! let client = Edgee::from_env()?;
//!
//! // Simple text completion
//! let response = client.send("anthropic/claude-haiku-4-5", "Hello, world!").await?;
//! println!("{}", response.text().unwrap_or(""));
//!
//! Ok(())
//! }
//! ```
//!
//! ## Streaming Example
//!
//! ```no_run
//! use edgee::Edgee;
//! use tokio_stream::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Edgee::from_env()?;
//!
//! let mut stream = client.stream("anthropic/claude-haiku-4-5", "Tell me a story").await?;
//!
//! while let Some(chunk) = stream.next().await {
//! if let Ok(chunk) = chunk {
//! if let Some(text) = chunk.text() {
//! print!("{}", text);
//! }
//! }
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Tool Calling Example
//!
//! ```no_run
//! use edgee::{Edgee, Message, InputObject, Tool, FunctionDefinition, JsonSchema};
//! use std::collections::HashMap;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Edgee::from_env()?;
//!
//! // Define a function
//! let function = FunctionDefinition {
//! name: "get_weather".to_string(),
//! description: Some("Get the weather for a location".to_string()),
//! parameters: JsonSchema {
//! schema_type: "object".to_string(),
//! properties: Some({
//! let mut props = HashMap::new();
//! props.insert("location".to_string(), serde_json::json!({
//! "type": "string",
//! "description": "The city and state, e.g. San Francisco, CA"
//! }));
//! props
//! }),
//! required: Some(vec!["location".to_string()]),
//! description: None,
//! },
//! };
//!
//! let input = InputObject::new(vec![
//! Message::user("What's the weather in San Francisco?")
//! ])
//! .with_tools(vec![Tool::function(function)]);
//!
//! let response = client.send("anthropic/claude-haiku-4-5", input).await?;
//!
//! if let Some(tool_calls) = response.tool_calls() {
//! println!("Tool calls: {:?}", tool_calls);
//! }
//!
//! Ok(())
//! }
//! ```
// Re-export main types for convenience
pub use ;
pub use ;
pub use *;