-
-
Notifications
You must be signed in to change notification settings - Fork 365
Add functions example to README #281
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
"content": "What is the weather like in San Francisco?", | ||
}, | ||
], | ||
functions: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes —
"What is the weather like in San Francisco?" returns:
{"role"=>"assistant", "content"=>nil, "function_call"=>{"name"=>"get_current_weather", "arguments"=>"{\n \"location\": \"San Francisco, CA\"\n}"}}
"What is the weather like in San Francisco in celsius?" returns:
{"role"=>"assistant", "content"=>nil, "function_call"=>{"name"=>"get_current_weather", "arguments"=>"{\n \"location\": \"San Francisco, CA\",\n \"unit\": \"celsius\"\n}"}}
"What is 1+1" returns:
{"role"=>"assistant", "content"=>"1 + 1 is equal to 2."}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, when I run this I just get:
{"message"=>"Unrecognized request argument supplied: functions", "type"=>"invalid_request_error", "param"=>nil, "code"=>nil}```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i get it. You need to use the latest model (for example):
gpt-4-0613
69fc57d
to
b01ca38
Compare
Thanks @seanmccann! Works for me 👍 |
Doesn't work for me. The error I am getting is <NoMethodError: undefined method `chat' for #<OpenaiChatgpt::Client:0x0000000120abcbd0 @api_key="XXXXXXXXXX", @adapter=:net_http, @request_timeout=1200, @stubs=nil>> I have also tried model: "gpt-3.5-turbo-0613", Here is my function.
|
Add the standard weather example for function calling to the README
All Submissions: