From 5b0cab188e5cf54c8e35c1a7e1f1fb2957708506 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 7 Aug 2024 13:09:13 -0400 Subject: [PATCH] Move backend selection into interactive call --- emacs/.emacs.d/config/init-ai.el | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/emacs/.emacs.d/config/init-ai.el b/emacs/.emacs.d/config/init-ai.el index 51d639b..877a596 100644 --- a/emacs/.emacs.d/config/init-ai.el +++ b/emacs/.emacs.d/config/init-ai.el @@ -17,18 +17,16 @@ "mistral-nemo:latest"))) (setq gptel-backend gptel-backend-openai gptel-model "gpt-4o") - (defun gptel-select-backend () - (interactive) - (let ((backend - (cl-loop - for (name . backend) in gptel--known-backends - nconc (cl-loop for model in (gptel-backend-models backend) - collect (list (concat name ":" model) backend model)) - into models-alist finally return - (cdr (assoc (completing-read "Backend: " models-alist nil t) - models-alist))))) - (setq gptel-backend (car backend) - gptel-model (cadr backend)))) + (defun gptel-select-backend (backend) + (interactive (list (cl-loop + for (name . backend) in gptel--known-backends + nconc (cl-loop for model in (gptel-backend-models backend) + collect (list (concat name ":" model) backend model)) + into models-alist finally return + (cdr (assoc (completing-read "Backend: " models-alist nil t) + models-alist))))) + (setq gptel-backend (car backend) + gptel-model (cadr backend))) (add-to-list 'gptel-directives '(shell-command . "You are a command line helper. Generate shell commands that do what is requested, without any additional description or explanation. Reply in plain text with no Markdown or other syntax. Reply with the command only.")) (add-to-list 'gptel-directives '(org-mode . "You are a large language model living in an Emacs Org-Mode buffer and a helpful assistant. You may evaluate Emacs Lisp, Python, and shell-script code when necessary by outputting an Org-Mode source block. You don't need to ask for confirmation before evaluating code. I will execute the source block and display the results in the buffer. Respond concisely.