emacs

witek 2025-08-20T07:40:49.643649Z

Hi. I need a hint, how to programatically invoke gptel

witek 2025-08-20T07:41:11.954599Z

I have configured https://github.com/karthink/gptel. I have my own tools and my own system prompts. I can run gptel and use the transient interface to select prompt, tools, etc. Now I want to create my own command my-gptel-emacsagent which uses gptel, but skips the transient interface. Instead it always starts a new session, selects emacsagent as system prompt, activates the tool emacs_eval and reads the user prompt from minibuffer. What does the implementation of (defun my-gptel-emacsagent () ...) look like?

tatut 2025-08-20T07:59:53.413849Z

I just use gptel-send bound to a key

witek 2025-08-20T08:02:00.233829Z

How do you pass the system prompt or the usable tools?

tatut 2025-08-20T08:03:25.263589Z

it just uses what I've previously set in the gptel menu, but I guess you want some context dependent settings?

witek 2025-08-20T08:04:00.144219Z

What I want is one command which uses system prompt A and tools t-1 and t-2. And a second command which always uses system prompt B and tools t-3 and t-4.

witek 2025-08-20T08:05:02.950009Z

Selecting system prompt and activating tools on every request is very annoying.

witek 2025-08-20T08:06:42.145209Z

I suppose there is a way to pass these as parameters to gptel-send but I can not figure out how.

witek 2025-08-20T08:21:54.835409Z

I found the solution here: https://github.com/karthink/gptel/wiki/Defining-custom-gptel-commands

2025-08-20T10:38:40.613219Z

I use gptel-request like this (with a callback): https://github.com/DavidVujic/my-emacs-config/blob/master/customizations/setup-python-rdd-llm.el#L39

witek 2025-08-20T12:04:12.683119Z

gptel-request does not support tools 😞

Joseph Ferano 2025-08-26T08:12:57.093149Z

Hey witek, here's my config, hopefully this can be of use https://git.ferano.io/JosephFerano/dotfiles/src/branch/master/.config/emacs/init.org#headline-65

🙏 1