Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gptel agents or configuration presets #542

Open
karthink opened this issue Jan 2, 2025 · 3 comments
Open

gptel agents or configuration presets #542

karthink opened this issue Jan 2, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@karthink
Copy link
Owner

karthink commented Jan 2, 2025

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)

@ovistoica
Copy link

Gptel presets would be very useful!

I created a per-project side panel chat workflow inspired by Cursor, and changing the context for each project is not ideal. I would much appreciate a list of presets I could set (maybe with .dir-locals) for each project.

References:

Functionality

(use-package ai-project-agent
  :after (gptel flycheck)
  :bind (("C-c c a" . ai-project-agent-toggle-panel)
         ("C-c c d" . ai-project-agent-clear-panel)
         ("C-c c c" . gptel-add)
         ("C-c c l" . ai-project-agent-send-lint-feedback)
         ("C-c c RET" . ai-project-agent-send)))

@skissue
Copy link

skissue commented Jan 18, 2025

I agree that this would be great to have! I envision being able to use it to easily create an agent-based workflow, so it would be nice if a preset could simply be passed to gptel-request:

(gptel-request
 "prompt"
 :preset "some-preset-name")

Since a lot of gptel settings can be set via dynamic variables, a possible stop-gap implementation right now could be to define a preset as an alist of variable bindings (e.g. gptel--system-message, gptel-backend, gptel-model, etc.) and then bind them during the call to gptel-request (e.g. with cl-progv). Not sure if it would work in practice, just an idea!

@ahmed-shariff
Copy link

ahmed-shariff commented Jan 26, 2025

This is based on our discussion: :fsm could be another parameter for an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants