Variable: gptel-prompt-filter-hook

gptel-prompt-filter-hook is an alias and customizable for gptel-prompt-transform-functions, defined in gptel-request.el.

This variable is obsolete since 0.9.9; use gptel-prompt-transform-functions instead.

Value

(gptel--transform-apply-preset
 gptel--transform-add-context)

Documentation

Handlers to augment or transform a query before sending it.

This hook is called in a temporary buffer containing the text to be sent, with the cursor at the end of the prompt. You can use it to modify the buffer or buffer-local variables as required.

Since these functions modify the prompt construction buffer, the order
in which they run is significant! In particular, you may want to add
your function before (the default) or after gptel--transform-add-context, which adds gptel's context (other buffers, files etc) to this buffer.

Example: A typical use case might be to search for occurrences of $(cmd) and replace it with the output of the shell command cmd, making it easy to send the output of shell commands to the LLM.

Transform functions can be synchronous or asynchronous.

Synchronous hook functions must accept zero or one argument: the state
 machine (see gptel-fsm) for the current request.

Asynchronous hook functions must accept two arguments: a callback to call after the transformation is complete, and the state machine for the current request.

Note that while this set of handlers can certainly be set with a global value to be applied to all queries in all buffers, it meant to be set locally for a specific buffer, or chat topic, or only the context of a certain task.

Aliases

gptel-prompt-transform-functions