Skip to content
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

Custom Functions with parameters never called #141

Open
miquellaboria opened this issue Dec 22, 2023 · 1 comment
Open

Custom Functions with parameters never called #141

miquellaboria opened this issue Dec 22, 2023 · 1 comment

Comments

@miquellaboria
Copy link

Describe the bug
I implement a custom function with parameters to be called form OpenAI API, but always call without the parameters:

To Reproduce
Definition of Function
ChatFunctionDeclaration ( name: "get_sleep_data", description: "Returns the sleep Data for an specified date", parameters: JSONSchema( type: .object, properties: [ "Sleepdate": .init(type: .string, description: "The date do you want to get the data for, in format yyyy-MM-dd") ], required: ["Sleepdate"] ) )

Viewing the body request to OpenAI:

"functions": [ { "parameters": { "properties": {}, "required": [], "type": "object" }, "name": "get_date_and_time", "description": "Returns the current date and time" }, { "name": "get_sleep_data", "parameters": { "properties": { "Sleepdate": { "type": "string", "description": "The date do you want to get the data for, in format yyyy-MM-dd" } }, "type": "object", "required": [ "Sleepdate" ] }, "description": "Returns the sleep Data for an specified date" } ],

But when OpenAI send a Call Function always send without parameter:

data: {"id”:”xxx,”object":"chat.completion.chunk","created":1703277440,"model":"gpt-4-1106-preview","system_fingerprint”:”xxx”,”choices":[{"index":0,"delta":{"role":"assistant","content":null,"function_call":{"name":"get_sleep_data","arguments":""}},"logprobs":null,"finish_reason":null}]}

Expected behavior
The Function Call recives parameters.

Calls with NO parameters works fine.

Thanks for your help!

@jeremypearson
Copy link

I've been experiencing this same problem ever since I upgraded to the latest version of the MacPaw OpenAI Package. The arguments for every function call are empty, even when there are one or more parameters in the ChatQuery.ChatCompletionToolParam that are specified as "required". I've even experienced this problem when using the latest version's Demo's ChatStore class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants