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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//! # Helios Engine
//!
//! Helios is a powerful and flexible Rust framework for building LLM-powered agents
//! with tool support, chat capabilities, and easy configuration management.
//!
//! ## Quick Start
//!
//! ### Using as a Library (Direct LLM Calls)
//!
//! ## Example
//! ```no_run
//! use helios_engine::{LLMClient, ChatMessage};
//! use helios_engine::config::LLMConfig;
//!
//! #[tokio::main]
//! async fn main() -> helios_engine::Result<()> {
//! let llm_config = LLMConfig {
//! model_name: "gpt-3.5-turbo".to_string(),
//! base_url: "https://api.openai.com/v1".to_string(),
//! api_key: std::env::var("OPENAI_API_KEY").unwrap(),
//! temperature: 0.7,
//! max_tokens: 2048,
//! };
//!
//! let client = LLMClient::new(helios_engine::llm::LLMProviderType::Remote(llm_config)).await?;
//! let messages = vec![
//! ChatMessage::system("You are a helpful assistant."),
//! ChatMessage::user("What is the capital of France?"),
//! ];
//!
//! let response = client.chat(messages, None, None, None, None).await?;
//! println!("Response: {}", response.content);
//! Ok(())
//! }
//! ```
//!
//! ## Overview
//!
//! ```no_run
//! use helios_engine::{Agent, Config, CalculatorTool};
//!
//! #[tokio::main]
//! async fn main() -> helios_engine::Result<()> {
//! let config = Config::from_file("config.toml")?;
//!
//! let mut agent = Agent::builder("MyAgent")
//! .config(config)
//! .system_prompt("You are a helpful assistant.")
//! .tool(Box::new(CalculatorTool))
//! .build()
//! .await?;
//!
//! let response = agent.chat("What is 15 * 7?").await?;
//! println!("Agent: {}", response);
//! Ok(())
//! }
//! ```
//!
//! ## Features
//!
//! - **Direct LLM Access**: Use `LLMClient` for simple, direct calls to LLM models.
//! - **Agent System**: Create intelligent agents with tools and persistent conversation.
//! - **Tool Support**: Extensible tool system for adding custom functionality.
//! - **Multi-Provider**: Works with OpenAI, Azure OpenAI, local models, and any OpenAI-compatible API.
//! - **Type-Safe**: Leverages Rust's type system for reliability.
//! - **Async**: Built on Tokio for high-performance async operations.
// Modules
/// Defines the `Agent` struct and its associated builder, which are central to the Helios Engine.
/// Provides chat-related functionality, including `ChatMessage`, `ChatSession`, and `Role`.
/// Handles configuration for the engine, including LLM providers and agent settings.
/// Defines the custom `HeliosError` and `Result` types for error handling.
/// Manages interactions with Large Language Models (LLMs), including different providers.
/// Contains the tool system, including the `Tool` trait and various tool implementations.
/// Simplified tool creation with the builder pattern.
/// Macros for ultra-simple tool creation.
/// Provides HTTP server functionality for exposing OpenAI-compatible API endpoints.
/// Simplified endpoint creation with the builder pattern for custom HTTP endpoints.
/// RAG (Retrieval-Augmented Generation) system with vector stores and embeddings.
/// RAG tool implementation for agent use.
/// Forest of Agents - Multi-agent collaboration system.
/// AutoForest - Automatic orchestration of agent forests for complex tasks.
/// Candle backend provider for running local models.
/// Candle model implementations for various architectures.
// Re-exports
/// Re-export of the `Agent` and `AgentBuilder` for convenient access.
pub use ;
/// Re-export of chat-related types.
pub use ;
pub use CandleConfig;
pub use LocalConfig;
/// Re-export of configuration types.
pub use ;
/// Re-export of the custom error and result types.
pub use ;
/// Re-export of LLM-related types.
pub use ;
pub use ;
pub use ;
/// Re-export of tool builder for simplified tool creation.
pub use ToolBuilder;
/// Re-export of RAG system components.
pub use ;
/// Re-export of RAG tool.
pub use RAGTool;
/// Re-export of serve functionality.
pub use ;
/// Re-export of endpoint builder for simplified custom endpoint creation.
pub use ;
/// Re-export of Forest of Agents functionality.
pub use ;
/// Re-export of AutoForest functionality.
pub use ;