Expand description
§agentic-llm
LLM adapters for the Agentic Framework.
Supports multiple providers:
OpenAI(GPT-4, GPT-4o, o1)- Ollama (local models)
- Anthropic (Claude Sonnet, Haiku, Opus)
- Google Gemini (Gemini 2.0 Flash, 1.5 Pro)
§Example
use agentic_llm::{LLMAdapter, OpenAIAdapter, LLMMessage};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let adapter = OpenAIAdapter::new("sk-...", "gpt-4o");
let messages = vec![
LLMMessage::system("You are a helpful assistant."),
LLMMessage::user("Hello!"),
];
let response = adapter.generate(&messages).await?;
println!("{}", response.content);
Ok(())
}Structs§
- LLMMessage
- A message in a conversation.
- LLMResponse
- Response from an LLM.
- Ollama
Adapter - Ollama adapter for local models.
- OpenAI
Adapter OpenAIadapter for GPT models.- Stream
Chunk - A chunk from streaming response.
- Token
Usage - Token usage statistics.
Enums§
- Finish
Reason - Reason for completion finishing.
- LLMError
- Errors that can occur when interacting with LLM providers.
- Role
- Role in a conversation.
Traits§
- LLMAdapter
- Trait for LLM adapters.