branch: externals/ellama
commit 785c93c90c08784e8369d0230b21169204272ac0
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>

    Add ask_user tool for user clarification
    
    Added a new tool called "ask_user" that allows the system to pose questions 
to
    the user and receive clarifications. This tool takes a question and a list 
of
    possible answer variants, and uses completing-read to prompt the user for a
    response. The tool is integrated into the ellama-tools-available list, 
making it
    available for use in the system.
---
 ellama-tools.el | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/ellama-tools.el b/ellama-tools.el
index e5f8e223c8..5e2ff71815 100644
--- a/ellama-tools.el
+++ b/ellama-tools.el
@@ -566,5 +566,34 @@ Replace OLDCONTENT with NEWCONTENT."
                 :description
                 "Return current project root directory."))
 
+(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)))
+
+(add-to-list
+ 'ellama-tools-available
+ (llm-make-tool :function
+                'ellama-tools-ask-user-tool
+                :name
+                "ask_user"
+                :args
+                (list
+                 '(:name
+                   "question"
+                   :type
+                   string
+                   :description
+                   "Question to ask user for clarification.")
+                 '(:name
+                   "answer_variant_list"
+                   :type array
+                   :description
+                   "List of possible answer variants."
+                   :items (:type string)))
+                :description
+                "Ask user a QUESTION to receive a clarification.
+ANSWER-VARIANT-LIST is a list of possible answer variants."))
+
 (provide 'ellama-tools)
 ;;; ellama-tools.el ends here

Reply via email to