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

Fix issue with empty function call args for Open AI #99

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Centralize model list so things like Vertex and Open AI compatible libraries can have more accurate context lengths and capabilities.
- Update default Gemini chat model to Gemini 1.5 Pro.
- Update default Claude chat model to latest Sonnet version.
- Fix issue in some Open AI compatible providers with empty function call arguments
* Version 0.17.4
- Fix problem with Open AI's =llm-chat-token-limit=.
- Fix Open AI and Gemini's parallel function calling.
Expand Down
7 changes: 5 additions & 2 deletions llm-openai.el
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ STREAMING if non-nil, turn on response streaming."
(make-llm-provider-utils-function-call
:id (assoc-default 'id call)
:name (assoc-default 'name function)
:args (json-read-from-string (assoc-default 'arguments function)))))
:args (json-read-from-string
(let ((args (assoc-default 'arguments function)))
(if (= (length args) 0) "{}" args))))))
(assoc-default 'tool_calls
(assoc-default 'message
(aref (assoc-default 'choices response) 0)))))
Expand All @@ -211,7 +213,8 @@ FCS is a list of `make-llm-provider-utils-function-call'"
`(("id" . ,(llm-provider-utils-function-call-id fc))
("type" . "function")
("function" .
(("arguments" . ,(json-encode (llm-provider-utils-function-call-args fc)))
(("arguments" . ,(json-encode
(llm-provider-utils-function-call-args fc)))
("name" . ,(llm-provider-utils-function-call-name fc))))))
fcs))))

Expand Down