-
Notifications
You must be signed in to change notification settings - Fork 321
Description
Note
This feature has been implemented.
You can now define "presets", which are a bundle of gptel options, such as the backend, model, system message, included tools, temperature and so on. This set of options can be applied together, making it easy to switch between different tasks using gptel. From gptel's transient menu, you can save the current configuration as a preset or apply another one. Presets can be applied globally, buffer-locally or for the next request only. To persist presets across Emacs sessions, define presets in your configuration using gptel-make-preset
.
Original feature request follows:
A suggestion when you do get to this, I find the system message one prefers often depends on the model that is selected. I find when having a dialogue, in which I switch models mid-chat, I also sometimes need to switch the system prompt to better match the new model.
This appears to be a need that many users have. There are many discussions threads where people have asked how to implement a "presets" feature. I think it might make sense to add a presets feature to the package which is a bundle of configuration you can switch to all at once.
(gptel-make-preset
"coding-preset"
:system "system message for coding here..." ; can be a function, see gptel-directives
:backend gptel--anthropic-backend ; or name of backend, like "Claude"
:model 'claude-3-sonnet-20240229
:context 'gptel-context-lsp
:tools (list gptel-tool-1 gptel-tool-2 ...) ; list of gptel tools to supply
:callback nil)
You can then select a preset from the transient menu, which sets all of these options at once. Via the "scope" switch in the menu, this preset can be set globally, in one buffer or just for the next request.
Some of these options/sources (like gptel-context-lsp
) don't exist yet. :callback
is basically a custom action you can specify instead of inserting the response, with nil being the default callback gptel uses.
In other LLM clients this is called an "agent", but really they're just a bundle of prompts+configuration.
Originally posted by @karthink in #416 (comment)