emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/llm 9cbd222010: Fix Claude tool use with empty argument


From: ELPA Syncer
Subject: [elpa] externals/llm 9cbd222010: Fix Claude tool use with empty arguments (#171) (#172)
Date: Tue, 18 Mar 2025 18:59:40 -0400 (EDT)

branch: externals/llm
commit 9cbd2220107d50c47a759b91d142321b88ec32a9
Author: Paul Nelson <63298781+ultronozm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Fix Claude tool use with empty arguments (#171) (#172)
    
    * (llm-provider-collect-streaming-tool-uses): Handle case where Claude
    returns the empty string for tool use arguments.
---
 llm-claude.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llm-claude.el b/llm-claude.el
index eda858a103..fb9a5a94dc 100644
--- a/llm-claude.el
+++ b/llm-claude.el
@@ -208,9 +208,11 @@ DATA is a vector of lists produced by 
`llm-provider-streaming-media-handler'."
                        (concat (llm-provider-utils-tool-use-args tool) 
input)))))
     (maphash (lambda (_ tool)
                (condition-case nil
-                   (setf (llm-provider-utils-tool-use-args tool)
-                         (json-parse-string (llm-provider-utils-tool-use-args 
tool)
-                                            :object-type 'alist))
+                   (let ((args (llm-provider-utils-tool-use-args tool)))
+                     (setf (llm-provider-utils-tool-use-args tool)
+                           (if (string-empty-p args)
+                               nil
+                             (json-parse-string args :object-type 'alist))))
                  (error nil))
                (push tool result))
              tools)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]