Closed alx closed 6 days ago
Hello, @alx !
Sorry I didn't see this yesterday!
In my config, I load the the gjg/gptel-build-directives
function that is included in this AIPIKHAL repo.
the poorly-named build-directives-fun
symbol is just the path to the file where that function is defined.
If it is there, I load
the file - this is the step I think you were missing.
From that point on, you can do what you were doing with setq gptel-directives
Note that I'm not doing it inside of use-package
- just out of laziness.
Here's what my config looks like
;; Use the system prompt builder function
(let ((build-directives-fun "~/projects/ai/AIPIHKAL/gptel-build-directives.el"))
(when (f-exists-p build-directives-fun)
(load build-directives-fun)
;; (custom-set-variables '(gptel-directives
(setq gptel-directives (gjg/gptel-build-directives "~/projects/ai/AIPIHKAL/system-prompts/")
gptel-system-message (alist-get 'default gptel-directives))))
Hello @gregoryg,
Thanks for your help, I was able to load my built prompt using your example.
In my Doom Emacs config.el
:
(use-package! gptel
:config
(setq
gptel-model 'claude-3-opus-20240229
gptel-backend (gptel-make-anthropic "Claude"
:stream t :key "sk-ant-..."
))
(let ((build-directives-fun "~/code/AIPIHKAL/gptel-build-directives.el"))
(when (file-exists-p build-directives-fun)
(load build-directives-fun)
;; (custom-set-variables '(gptel-directives
(setq gptel-directives (gjg/gptel-build-directives "~/code/AIPIHKAL/system-prompts/")
gptel-system-message (alist-get 'default gptel-directives))))
)
I had to change some function calls to make it work on my current emacs setup:
f-name
to builtin file-base-name
f-exists-p
to builtin file-exists-p
Your examples are super useful in showing how to use the world's most popular configuration framework for emacs. Maybe we can add a Doom setup section
Hi Gregory,
I'm trying to load the built system prompts as gptel directives when emacs is starting up, with the following configuration lines in my
config.el
loaded at startup:I've tried various method without success, could you help me figure out how to do it?
(provide 'gptel-build-directives)
andgptel-build-directives.el
file alongside myconfig.el
(require "gptel-build-directives.el")
andgptel-build-directives.el
file alongside myconfig.el
(defun gjg/parse-prompt-file...
and(defun gjg/gptel-build-directives...
directly in myconfig.el
, there is an issue with a missingf-base
function.Here is my dotfile repository and the line in the
config.el
file: https://github.com/alx/dots/blob/main/dotfiles/doom/config.el#L154