File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Fix invalid request 400, for tool calls with nil arguments failing when using Anthropic models via GitHub Copilot. #340
6+
57## 0.109.2
68
79- Add ` chat/clear ` message.
Original file line number Diff line number Diff line change 100100 " tool_call" {:type " function_call"
101101 :name (:full-name content)
102102 :call_id (:id content)
103- :arguments (json/generate-string (:arguments content))}
103+ :arguments (json/generate-string (or ( :arguments content) {} ))}
104104 " tool_call_output"
105105 {:type " function_call_output"
106106 :call_id (:id content)
Original file line number Diff line number Diff line change 168168 :tool_calls [(cond-> {:id tool-call-id
169169 :type " function"
170170 :function {:name (:full-name content)
171- :arguments (json/generate-string (:arguments content))}}
171+ :arguments (json/generate-string (or ( :arguments content) {} ))}}
172172 ; ; Preserve Google Gemini thought signatures if present
173173 (:external-id content)
174174 (assoc-in [:extra_content :google :thought_signature ]
Original file line number Diff line number Diff line change 146146 thinking-start-tag
147147 thinking-end-tag))))
148148
149+ (testing " Tool call transformation with nil arguments defaults to empty object"
150+ (is (match?
151+ {:role " assistant"
152+ :tool_calls [{:id " call-123"
153+ :type " function"
154+ :function {:name " foo__diagnostics"
155+ :arguments " {}" }}]}
156+ (#'llm-providers.openai-chat/transform-message
157+ {:role " tool_call"
158+ :content {:id " call-123"
159+ :full-name " foo__diagnostics"
160+ :arguments nil }}
161+ true
162+ thinking-start-tag
163+ thinking-end-tag))))
164+
149165 (testing " Tool call transformation prefers :llm-tool-call-id when present"
150166 (is (match?
151167 {:role " assistant"
Original file line number Diff line number Diff line change 150150 :error false
151151 :text " Allowed directories: /foo/bar" }]}}}
152152 {:role " assistant" :content [{:type :text :text " I see /foo/bar" }]}]
153+ true ))))
154+ (testing " With tool_call with nil arguments defaults to empty object"
155+ (is (match?
156+ [{:role " user" :content [{:type " input_text" :text " Check diagnostics" }]}
157+ {:type " function_call"
158+ :call_id " call-1"
159+ :name " eca__editor_diagnostics"
160+ :arguments " {}" }]
161+ (#'llm-providers.openai/normalize-messages
162+ [{:role " user" :content [{:type :text :text " Check diagnostics" }]}
163+ {:role " tool_call" :content {:id " call-1" :full-name " eca__editor_diagnostics" :arguments nil }}]
153164 true )))))
You can’t perform that action at this time.
0 commit comments