Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mira integration #282

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions rig-core/examples/agent_with_mira.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use rig::completion::Prompt;
use std::error::Error;

#[tokio::main]

Check warning on line 4 in rig-core/examples/agent_with_mira.rs

View workflow job for this annotation

GitHub Actions / stable / fmt

Diff in /home/runner/work/rig/rig/rig-core/examples/agent_with_mira.rs
async fn main() -> Result<(), Box<dyn Error>> {
// Initialize the Mira client with your API key
let client = rig::providers::mira::Client::new(
"mira-api-key",
)?;

// Create an agent with the Mira model
let agent = client
.agent("claude-3.5-sonnet")
.preamble("You are a helpful AI assistant.")
.temperature(0.7)
.build();

// Send a message to the agent
let response = agent.prompt("What are the 7 wonders of the world?").await?;

// Print the response
println!("Assistant: {}", response);

// List available models
println!("\nAvailable models:");
let models = client.list_models().await?;
for model in models {
println!("- {}", model);
}

// Get user credits
let credits = client.get_user_credits().await?;
println!("\nUser credits: {:?}", credits);

Ok(())
}
Loading
Loading