blob: 46546138f0c68a13e53ff037f43fdd15e163c2a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|