-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide function call example using tool_calls #143
Labels
Comments
Here is an example of how to use it meanwhile: let tool = ChatCompletionToolArgs::default()
.r#type(async_openai::types::ChatCompletionToolType::Function)
.function(ChatCompletionFunctions {
name: "get_current_weather".to_string(),
description: Some("Get weather in location".to_string()),
parameters: json!({
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use. Infer this from the users location.",
},
},
"required": ["location", "format"],
})
}).build()?; and for the tool choice .tool_choice(ChatCompletionToolChoiceOption::Auto) Though I am not sure it is working right now!
|
Okay thanks, I will continue using the deprecated option for now and maybe come back to this when it has been tested further. or test it some on my own later. |
When leaving out .tool_choice(ChatCompletionToolChoiceOption::Auto) it should work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/64bit/async-openai/blob/main/examples/function-call/src/main.rs
The current function call example uses the now deprecated
ChatCompletionResponseMessage::function_call
field. It was deprecated in favor ofChatCompletionResponseMessage::tool_calls
. Can an example be provided using the newtool_calls
method?The text was updated successfully, but these errors were encountered: