-
I just want to ask if rig extractor mechanism works with gemini provider, i have this simple example which does not work? use rig::providers::gemini;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, JsonSchema, Serialize)]
/// A record representing a person
struct Person {
/// The person's first name, if provided (null otherwise)
pub first_name: Option<String>,
/// The person's last name, if provided (null otherwise)
pub last_name: Option<String>,
/// The person's job, if provided (null otherwise)
pub job: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Create Gemini client
let client = gemini::Client::new("API_KEY");
// Create extractor
let data_extractor = client
.extractor::<Person>(gemini::completion::GEMINI_1_5_PRO)
.context("foo")
.build();
let person = data_extractor
.extract("Hello my name is John Doe! I am a software engineer.")
.await?;
println!("GPT-4: {}", serde_json::to_string_pretty(&person).unwrap());
Ok(())
} output: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hey, this looks like a bug on our part! We'll have to resolve this in an issue, thanks for tracking this down! |
Beta Was this translation helpful? Give feedback.
Fix is here #297 !