branch: externals/ellama
commit 1fa5952d9bf30ce75c9825d6ba213bcdb0c5c2df
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Add JSON support to answer variants
Modified `ellama-tools-ask-user-tool` to accept both list and JSON string
inputs
for answer variants. When `answer-variant-list` is a string, it is parsed
using
`json-parse-string` and converted to a list, enabling compatibility with
sources
that provide answer variants as JSON strings.
---
ellama-tools.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ellama-tools.el b/ellama-tools.el
index 0ef6524ef5..8604a9baa0 100644
--- a/ellama-tools.el
+++ b/ellama-tools.el
@@ -572,7 +572,10 @@ Replace OLDCONTENT with NEWCONTENT."
(defun ellama-tools-ask-user-tool (question answer-variant-list)
"Ask user a QUESTION to receive a clarification.
ANSWER-VARIANT-LIST is a list of possible answer variants."
- (completing-read (concat question " ") (seq--into-list answer-variant-list)))
+ (completing-read (concat question " ")
+ (if (stringp answer-variant-list)
+ (seq--into-list (json-parse-string answer-variant-list))
+ (seq--into-list answer-variant-list))))
(ellama-tools-define-tool
'(:function