use oris_runtime::{
agent::create_agent_with_structured_output,
schemas::structured_output::{ProviderStrategy, StructuredOutputSchema},
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
struct ProductReview {
rating: Option<i32>,
sentiment: String,
key_points: Vec<String>,
}
impl StructuredOutputSchema for ProductReview {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let strategy = ProviderStrategy::<ProductReview>::new().with_strict(true);
let agent = create_agent_with_structured_output(
"gpt-4o-mini",
&[],
Some("You are a helpful assistant that analyzes product reviews."),
Some(Box::new(strategy)),
None, )?;
let result = agent
.invoke_messages(vec![oris_runtime::schemas::Message::new_human_message(
"Analyze this review: 'Great product: 5 out of 5 stars. Fast shipping, but expensive'",
)])
.await?;
println!("Agent response: {}", result);
Ok(())
}