Closed moom-en closed 2 months ago
Please take a look at https://github.com/64bit/async-openai/tree/main/examples/assistants-func-call-stream it has multiple function calls, same idea can be applied for chat completions?
Please take a look at https://github.com/64bit/async-openai/tree/main/examples/assistants-func-call-stream it has multiple function calls, same idea can be applied for chat completions?
Thanks, I defined multiple functions, but basically the first one will be executed every time. Others can also be executed, but the probability of triggering is not as high as the first one. I don't know why. Also, when I ask some regular questions that don't require function calls at all, she will also adjust a certain function, which also makes me confused. . .
Your queries are specific to behavior of the API, right channel for it is official OpenAI channels:
Your queries are specific to behavior of the API, right channel for it is official OpenAI channels:
Thanks
Why do I execute one function every time and not multiple functions?
let request = CreateChatCompletionRequestArgs::default()
.max_tokens(512u16)
.model("gpt-3.5-turbo-0125")
.messages("Can you tell me which doctors will be available the day after tomorrow?")
.tools(vec![ChatCompletionToolArgs::default()
.r#type(ChatCompletionToolType::Function)
.function(
FunctionObjectArgs::default()
.name("register_list")
.description("Query the doctor’s consultation registration information on a certain day")
.parameters(json!({
"type": "object",
"properties": {
"date": {
"type": "string",
"description": "visit date,format:yyyy-MM-dd,e.g:2024-01-01",
},
},
"required": ["date"],
}))
.build()?,
)
.build()?,
ChatCompletionToolArgs::default()
.r#type(ChatCompletionToolType::Function)
.function(
FunctionObjectArgs::default()
.name("now_time")
.description("this is test, don't execute")
.build()?,
)
.build()?
])
.build()?;
if let Some(tool_calls) = res_msg.tool_calls {
println!("{:?}", tool_calls);
// always execute now_time, omitting part of the code
}
fn calc_now_time() -> String {
Local::now().naive_local().format("%Y-%m-%d %H:%M:%S").to_string()
}
fn erp_register_list(args: &str) -> String {
"doctor one".to_string()
}
I want, now_time should be executed first to convert the date and then register_list