From 50238a21bc64b9a3b90bdc0ccd71b060709406fb Mon Sep 17 00:00:00 2001 From: PalaceChan Date: Sat, 4 Jan 2025 12:36:46 -0500 Subject: [PATCH] gptel tweaks - use gptel-org-branching-context (as such remove limit on sent messages) - add anthropic backend --- config.org | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/config.org b/config.org index d3b51bc..6b5bc06 100644 --- a/config.org +++ b/config.org @@ -1033,19 +1033,24 @@ https://github.com/karthink/gptel (defun ava/init-gptel-mode () (visual-line-mode) (setq-local gptel-expert-commands t) - (setq-local gptel--num-messages-to-send 6) (setq-local gptel--system-message (alist-get 'default gptel-directives))) :hook (gptel-mode . ava/init-gptel-mode) :custom (gptel-model 'gpt-4o) (gptel-default-mode 'org-mode) (gptel-track-media t) - (gptel-directives '((default . "You are a helpful assistant living inside Emacs. The user is a computer programmer. Your responses are always concise, succinct, and to the point. You never apologize for confusions as that wastes time. If you generate blocks using three backticks inspect your response and add the appropriate programming language after the opening backticks.") + (gptel-directives '((default . "You are a helpful assistant living inside Emacs. The user is a computer programmer. Your responses are always concise, succinct, and to the point. You never apologize for confusions as that wastes time. If you generate blocks using three backticks inspect your response and add the appropriate programming language after the opening backticks. Do not use the asterisk character followed by whitespace for bullet points in your responses as this can interfere with org-mode rendering (you can use a hyphen instead)") (programmer . "You are a careful programmer. Provide code and only code as output without any additional text, prompt, or note. Do NOT use markdown backticks (```) to format your response.") (emacser . "You are an emacs maven. Reply with the most appropriate built-in Emacs command for the task I specify. Do NOT generate any additional description or explanation.") (cliwhiz . "You are a command line helper. Generate command line commands that do what is requested, without any additional description or explanation. Generate ONLY the command, without any markdown code fences.") (explainer . "You are a computer programmer's assistant. Explain what this code does") - (differ . "You are a computer programmer's assistant. Explain what this code diff hunk is doing, is it trying to fix something? Is it just a refactor? What is your understanding of the diff")))) + (differ . "You are a computer programmer's assistant. Explain what this code diff hunk is doing, is it trying to fix something? Is it just a refactor? What is your understanding of the diff"))) + :config + (setf (alist-get 'org-mode gptel-prompt-prefix-alist) "*Prompt*: " + (alist-get 'org-mode gptel-response-prefix-alist) "*Response*:\n") + (with-eval-after-load 'gptel-org + (setq-default gptel-org-branching-context t)) + (gptel-make-anthropic "claude" :key gptel-api-key :stream t)) #+end_src ** helm #+BEGIN_SRC emacs-lisp