diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-06-08 11:00:00 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-06-08 11:00:00 -0700 |
| commit | 2fb1c9cc4b770f2345ebe06b04eb60241f5bd8c1 (patch) | |
| tree | df19dd18dd3f9e51553a8da25ae3617801ad8bc1 /nix/users/fcuny/configs/emacs/site-lisp/init-llm.el | |
| parent | flake.lock: Update (diff) | |
| download | infra-2fb1c9cc4b770f2345ebe06b04eb60241f5bd8c1.tar.gz | |
structure emacs configuration
Diffstat (limited to '')
| -rw-r--r-- | nix/users/fcuny/configs/emacs/site-lisp/init-llm.el | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/nix/users/fcuny/configs/emacs/site-lisp/init-llm.el b/nix/users/fcuny/configs/emacs/site-lisp/init-llm.el new file mode 100644 index 0000000..4654613 --- /dev/null +++ b/nix/users/fcuny/configs/emacs/site-lisp/init-llm.el @@ -0,0 +1,36 @@ +;;; init-llm.el --- Configure LLMs -*- lexical-binding: t -*- +;; Author: Franck Cuny <franck@fcuny.net> + +;;; Commentary: + +;; Configure completions + +;;; Code: +(defvar fcuny/op-item-cache nil) + +(defun fcuny/read-op-item (op-item-path) + "Read and cache OP-ITEM-PATH item." + (or (cdr (assoc op-item-path fcuny/op-item-cache)) + (let ((key (string-trim-right + (shell-command-to-string (format "op read '%s'" op-item-path))))) + (unless (string-match-p "\\[ERROR\\]" key) + (push (cons op-item-path key) fcuny/op-item-cache) + key)))) + +(use-package gptel + :custom + (gptel-default-mode 'org-mode) + :config + (gptel-make-anthropic "Claude" :stream t :key (lambda () (fcuny/read-op-item "op://Private/anthropic llm/credential")))) + +(use-package aidermacs + :bind ("C-c a" . aidermacs-transient-menu) + :custom + (aider-args '("--no-check-update" "--no-show-model-warnings")) + (aidermacs-default-model "claude-3-7-sonnet-latest") + :config + (setenv "ANTHROPIC_API_KEY" (fcuny/read-op-item "op://Private/anthropic llm/credential"))) + +(provide 'init-llm) + +;;; init-llm.el ends here |
