helios_engine/lib.rs
1//! # Helios - LLM Agent Framework
2//!
3//! Helios is a powerful and flexible Rust framework for building LLM-powered agents
4//! with tool support, chat capabilities, and easy configuration management.
5//!
6//! ## Quick Start
7//!
8//! ### Using as a Library (Direct LLM Calls)
9//!
10//! ```no_run
11//! use helios_engine::{LLMClient, ChatMessage};
12//! use helios_engine::config::LLMConfig;
13//!
14//! #[tokio::main]
15//! async fn main() -> helios_engine::Result<()> {
16//! let llm_config = LLMConfig {
17//! model_name: "gpt-3.5-turbo".to_string(),
18//! base_url: "https://api.openai.com/v1".to_string(),
19//! api_key: std::env::var("OPENAI_API_KEY").unwrap(),
20//! temperature: 0.7,
21//! max_tokens: 2048,
22//! };
23//!
24//! let client = LLMClient::new(helios_engine::llm::LLMProviderType::Remote(llm_config)).await?;
25//! let messages = vec![
26//! ChatMessage::system("You are a helpful assistant."),
27//! ChatMessage::user("What is the capital of France?"),
28//! ];
29//!
30//! let response = client.chat(messages, None).await?;
31//! println!("Response: {}", response.content);
32//! Ok(())
33//! }
34//! ```
35//!
36//! ### Using with Agent System
37//!
38//! ```no_run
39//! use helios_engine::{Agent, Config, CalculatorTool};
40//!
41//! #[tokio::main]
42//! async fn main() -> helios_engine::Result<()> {
43//! let config = Config::from_file("config.toml")?;
44//!
45//! let mut agent = Agent::builder("MyAgent")
46//! .config(config)
47//! .system_prompt("You are a helpful assistant.")
48//! .tool(Box::new(CalculatorTool))
49//! .build()
50//! .await?;
51//!
52//! let response = agent.chat("What is 15 * 7?").await?;
53//! println!("Agent: {}", response);
54//! Ok(())
55//! }
56//! ```
57//!
58//! ## Features
59//!
60//! - **Direct LLM Access**: Use `LLMClient` for simple, direct calls to LLM models
61//! - **Agent System**: Create intelligent agents with tools and persistent conversation
62//! - **Tool Support**: Extensible tool system for adding custom functionality
63//! - **Multi-Provider**: Works with OpenAI, Azure OpenAI, local models, and any OpenAI-compatible API
64//! - **Type-Safe**: Leverages Rust's type system for reliability
65//! - **Async**: Built on Tokio for high-performance async operations
66
67pub mod agent;
68pub mod chat;
69pub mod config;
70pub mod error;
71pub mod llm;
72pub mod tools;
73
74// Re-export core types for convenient access
75pub use agent::{Agent, AgentBuilder};
76pub use chat::{ChatMessage, ChatSession, Role};
77pub use config::{Config, LLMConfig, LocalConfig};
78pub use error::{HeliosError, Result};
79pub use llm::{
80 Delta, LLMClient, LLMProvider, LLMRequest, LLMResponse, LocalLLMProvider, StreamChoice,
81 StreamChunk,
82};
83pub use tools::{CalculatorTool, EchoTool, FileSearchTool, FileReadTool, FileWriteTool, FileEditTool, Tool, ToolParameter, ToolRegistry, ToolResult};