use oris_runtime::{
agent::create_agent_with_structured_output,
schemas::structured_output::{StructuredOutputSchema, ToolStrategy},
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
struct ContactInfo {
name: String,
email: String,
phone: String,
}
impl StructuredOutputSchema for ContactInfo {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let strategy = ToolStrategy::<ContactInfo>::new()
.with_tool_message_content("Contact information extracted successfully!".to_string());
let agent = create_agent_with_structured_output(
"gpt-4o-mini",
&[],
Some("You are a helpful assistant that extracts contact information from text."),
Some(Box::new(strategy)),
None, )?;
let result = agent
.invoke_messages(vec![oris_runtime::schemas::Message::new_human_message(
"Extract contact info from: John Doe, [email protected], (555) 123-4567",
)])
.await?;
println!("Agent response: {}", result);
Ok(())
}