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: add Galadriel API integration #188

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 23 additions & 0 deletions rig-core/examples/agent_with_galadriel.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use rig::{completion::Prompt, providers};
use std::env;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Create Galadriel client
let client = providers::galadriel::Client::new(
&env::var("GALADRIEL_API_KEY").expect("GALADRIEL_API_KEY not set"),
env::var("GALADRIEL_FINE_TUNE_API_KEY").ok().as_deref(),
);

// Create agent with a single context prompt
let comedian_agent = client
.agent("gpt-4o")
.preamble("You are a comedian here to entertain the user using humour and jokes.")
.build();

// Prompt the agent and print the response
let response = comedian_agent.prompt("Entertain me!").await?;
println!("{}", response);

Ok(())
}
Loading
Loading