Add anthropic backend
This commit is contained in:
parent
ec0296421e
commit
f7614d70b4
1 changed files with 20 additions and 1 deletions
|
@ -343,6 +343,22 @@
|
||||||
;; :defer t
|
;; :defer t
|
||||||
;; :after json-mode)
|
;; :after json-mode)
|
||||||
|
|
||||||
|
(defun get-anthropic-key ()
|
||||||
|
"Retrieve the Anthropics API key using 'auth-source'."
|
||||||
|
(require 'auth-source)
|
||||||
|
(let* ((auth-source-creation-prompts
|
||||||
|
'((secret . "API key for %u@%h: ")))
|
||||||
|
(found (nth 0 (auth-source-search
|
||||||
|
:max 1
|
||||||
|
:host "api.anthropic.com"
|
||||||
|
:user "apikey"
|
||||||
|
:require '(:secret)
|
||||||
|
:create t)))
|
||||||
|
(secret (plist-get found :secret)))
|
||||||
|
(if (functionp secret)
|
||||||
|
(funcall secret)
|
||||||
|
secret)))
|
||||||
|
|
||||||
(use-package gptel
|
(use-package gptel
|
||||||
:bind (("C-c G m" . gptel-menu)
|
:bind (("C-c G m" . gptel-menu)
|
||||||
("C-c G n" . gptel)
|
("C-c G n" . gptel)
|
||||||
|
@ -361,7 +377,10 @@
|
||||||
(elisp . "Consider yourself an experienced Emacs Lisp developer with a deep understanding of Emacs's extensibility and customization capabilities. You're well-versed in creating and modifying Emacs modes, optimizing workflows, and integrating Emacs with other tools and services.")))
|
(elisp . "Consider yourself an experienced Emacs Lisp developer with a deep understanding of Emacs's extensibility and customization capabilities. You're well-versed in creating and modifying Emacs modes, optimizing workflows, and integrating Emacs with other tools and services.")))
|
||||||
:config
|
:config
|
||||||
(when (eq system-type 'windows-nt)
|
(when (eq system-type 'windows-nt)
|
||||||
(setq gptel-use-curl t)))
|
(setq gptel-use-curl t))
|
||||||
|
(gptel-make-anthropic "Claude"
|
||||||
|
:stream t
|
||||||
|
:key #'get-anthropic-key))
|
||||||
|
|
||||||
(use-package gnuplot
|
(use-package gnuplot
|
||||||
:defer t)
|
:defer t)
|
||||||
|
|
Loading…
Add table
Reference in a new issue