Expand description
Mecha10 AI - Large Language Models
This crate provides LLM integration as BehaviorNode implementations.
§Supported Providers
- Claude (Anthropic) - Claude 3.5 Sonnet, Claude 3 Opus, etc.
- OpenAI - GPT-4, GPT-4 Turbo, GPT-3.5
- Local - Ollama, Llama.cpp (HTTP API)
§Example
use mecha10_ai_llm::prelude::*;
// Create Claude LLM node
let mut llm = LlmNode::claude()
.with_model("claude-3-5-sonnet-20241022")
.with_system_prompt("You are a helpful robot assistant.")
.with_api_key(std::env::var("ANTHROPIC_API_KEY")?)
.build()?;
// Ask a question
llm.add_message("user", "What should I do next?");
let status = llm.tick(ctx).await?;
if let Some(response) = llm.last_response() {
println!("LLM: {}", response);
}Modules§
- prelude
- Prelude module for convenient imports
Structs§
- Claude
Provider - Claude (Anthropic) provider
- LlmConfig
- Configuration for an LLM node
- LlmMessage
- A message in the conversation
- LlmNode
- LLM node that generates text completions
- LlmNode
Builder - Builder for LLM nodes
- LlmResponse
- Response from LLM
- LlmUsage
- Token usage statistics
- OpenAI
Provider - OpenAI provider
Traits§
- LlmProvider
- Trait for LLM providers