1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// use tyrell::{Model, Role, ClaudeRequest, ContentType, ToolChoice, Tool, ToolBuilder};
// use serde::{Serialize, Deserialize};
// use schemars::JsonSchema;
// use test_log::test;
//
// #[test(tokio::test)]
// async fn test_super_bowl_extraction_auto_tool_choice() {
// #[derive(Debug, Serialize, Deserialize, JsonSchema)]
// struct SuperBowl {
// year: u16,
// winner: String,
// loser: String,
// winner_score: u8,
// loser_score: u8,
// total_points_scored: Option<u8>
// }
//
// impl ToolBuilder for SuperBowl {
// fn name() -> &'static str {
// "extract_super_bowl_info"
// }
//
// fn description() -> Option<&'static str> {
// Some("Extract Super Bowl information from text")
// }
// }
//
// let tool = Tool::new::<SuperBowl>();
//
// let request = ClaudeRequest::builder()
// .model(Model::Sonnet35)
// .add_message(
// Role::User,
// vec![ContentType::Text {
// text: "Extract the Super Bowl information from this text: The Green Bay Packers beat the Miami Dolphins in the 1982 Super Bowl 31-10.".to_string()
// }],
// )
// .max_tokens(200)
// .tools(vec![tool])
// .tool_choice(ToolChoice::Specific{name: "extract_super_bowl_info".to_string(), disable_parallel_tool_use: Some(false)})
// .build()
// .unwrap();
//
// println!("{:#?}", request);
// println!("{:#?}", serde_json::to_string(&request).unwrap());
//
// let response = request.call().await.unwrap();
//
// assert_eq!(response.role, Role::Assistant);
// assert!(!response.content.is_empty());
//
// }