Setting requirements
use orpheus::prelude::*;
fn main() {
let client = Orpheus::from_env().unwrap();
let calculator_tool = Tool::function("calculator")
.description("Do an operation on two items")
.with_parameters(|params| {
params
.property("x", Param::number())
.property("y", Param::number())
.property("op", Param::string().enums(["+", "-", "/", "*"]))
.required(["x", "y", "op"])
})
.build();
let res = client
.chat("What is 42 + 39?")
.model("qwen/qwen3-32b")
.tools([calculator_tool])
.with_preferences(|pref| pref.require_parameters(true)) // Will only send to providers that support tool calls
.send()
.unwrap();
println!("Model says: {}", res.content().unwrap());
}Last updated
Was this helpful?