mirror of https://github.com/0xplaygrounds/rig
Inception provider agent example
This commit is contained in:
parent
391e6c87d3
commit
bffb245eed
|
@ -0,0 +1,24 @@
|
|||
use std::env;
|
||||
|
||||
use rig::{completion::Prompt, providers::inception::client::ClientBuilder};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), anyhow::Error> {
|
||||
// Create Inception Labs client
|
||||
let client =
|
||||
ClientBuilder::new(&env::var("INCEPTION_API_KEY").expect("INCEPTION_API_KEY not set"))
|
||||
.build();
|
||||
|
||||
// Create agent with a single context prompt
|
||||
let agent = client
|
||||
.agent("mercury-coder-small")
|
||||
.preamble("You are a helpful AI assistant.")
|
||||
.temperature(0.0)
|
||||
.build();
|
||||
|
||||
// Prompt the agent and print the response
|
||||
let response = agent.prompt("Hello, how are you?").await?;
|
||||
println!("{}", response);
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue