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

    Accept lists as valid non-standard-params, but prefer vectors (#149)
---
 NEWS.org              |  1 +
 llm-provider-utils.el | 15 ++++++++++-----
 llm.el                | 12 ++++++------
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 2526a4a1be..b3bc85a48c 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,5 +1,6 @@
 * Version 0.23.0
 - Add GitHub's GitHub Models
+- Accept lists as nonstandard
 - Add Deepseek R1 model.
 * Version 0.22.0
 - Change ~llm-tool-function~ to ~llm-tool~, change ~make-llm-tool-function~ to 
take any arguments.
diff --git a/llm-provider-utils.el b/llm-provider-utils.el
index 95d9c4bdda..1822bbdb23 100644
--- a/llm-provider-utils.el
+++ b/llm-provider-utils.el
@@ -149,11 +149,16 @@ Return nil for the standard timeout.")
         (or (llm-chat-prompt-max-tokens prompt)
             (llm-standard-chat-provider-default-chat-max-tokens provider))
         (llm-chat-prompt-non-standard-params prompt)
-        ;; We need to merge the parameteres individually.
-        (seq-union (llm-chat-prompt-non-standard-params prompt)
-                   
(llm-standard-chat-provider-default-chat-non-standard-params provider)
-                   (lambda (a b)
-                     (equal (car a) (car b))))))
+        ;; We need to merge the parameters individually.
+        ;; Lists as values should be turned into vectors.
+        (mapcar (lambda (c)
+                  (if (listp (cdr c))
+                      (cons (car c) (vconcat (cdr c)))
+                    c))
+                (seq-union (llm-chat-prompt-non-standard-params prompt)
+                           
(llm-standard-chat-provider-default-chat-non-standard-params provider)
+                           (lambda (a b)
+                             (equal (car a) (car b)))))))
 
 (cl-defgeneric llm-provider-chat-request (provider prompt streaming)
   "Return the request for the PROVIDER for PROMPT.
diff --git a/llm.el b/llm.el
index 42bea1c51f..891f04a31f 100644
--- a/llm.el
+++ b/llm.el
@@ -300,12 +300,12 @@ usually turned into part of the interaction, and if so, 
they will
 be put in the first interaction of the prompt (before anything in
 PREVIOUS-INTERACTIONS).
 
-NON-STANDARD-PARAMS is an alist of other options that the
-provider may or may not know how to handle.  These are expected
-to be provider specific.  Don't use this if you want the prompt
-to be used amongst different providers, because it is likely to
-cause a request error.  The cars of the alist are strings and the
-cdrs can be strings or numbers.  This is optional."
+NON-STANDARD-PARAMS is an alist of other options that the provider may
+or may not know how to handle.  These are expected to be provider
+specific.  Don't use this if you want the prompt to be used amongst
+different providers, because it is likely to cause a request error.  The
+cars of the alist are strings and the cdrs can be strings, numbers or
+vectors (if a list).  This is optional."
   (unless content
     (error "CONTENT is required"))
   (when (and (listp content) (zerop (mod (length content) 2)))

Reply via email to