branch: externals/llm
commit 94b2cbf07d70868c9cdea9b7bd2f48ce0c8c906f
Author: Andrew Hyatt <ahy...@gmail.com>
Commit: GitHub <nore...@github.com>

    Handle special boolean values in JSON requests (#178)
---
 NEWS.org              | 1 +
 llm-provider-utils.el | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS.org b/NEWS.org
index 73908237fd..33c0cbda90 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -2,6 +2,7 @@
 - Fix issue with some Open AI compatible providers needing models to be passed 
by giving a non-nil default.
 * Version 0.24.1
 - Fix issue with Ollama incorrect requests when passing non-standard params.
+- Fix issue with JSON return specs which pass booleans
 * Version 0.24.0
 - Add =multi-output= as an option, allowing all llm results to return, call, 
or stream multiple kinds of data via a plist.  This allows separating out 
reasoning, as well as optionally returning text as well as tool uses at the 
same time.
 - Added ~llm-models~ to get a list of models from a provider.
diff --git a/llm-provider-utils.el b/llm-provider-utils.el
index fafd24c0da..c75c2e22ac 100644
--- a/llm-provider-utils.el
+++ b/llm-provider-utils.el
@@ -578,7 +578,13 @@ If MODEL cannot be found, warn and return DEFAULT, which 
by default is 4096."
 The expectation is that any symbol values will be converted to strings
 for plist and any nested plists."
   (mapcan (lambda (elem-pair)
-            (cond ((symbolp (nth 1 elem-pair))
+            (cond ((member (nth 1 elem-pair) '(:json-false :false))
+                   (list (car elem-pair) :false))
+                  ((eq (nth 1 elem-pair) t)
+                   (list (car elem-pair) t))
+                  ((not (nth 1 elem-pair))
+                   (list (car elem-pair) :null))
+                  ((symbolp (nth 1 elem-pair))
                    (list (car elem-pair)
                          (symbol-name (nth 1 elem-pair))))
                   ((consp (nth 1 elem-pair))

Reply via email to