* gptel.el (gptel--attach-response-history, gptel--ediff,
gptel--next-variant, gptel--previous-variant,
gptel--mark-response):
Add `gptel--attach-response-history` -- this can be used to add
text properties to the next gptel response in the buffer. This
is (currently) useful for tracking changes when the response
overwrites existing text.
The next three commands -- `gptel--ediff`,
`gptel--previous-variant`, `gptel--next-variant` -- provide
facilities for manipulating a gptel response at point when there
is history. `gptel--mark-response` marks the response at point.
These are considered internal functions for now and can be
accessed from the transient menu, where they work together with
`gptel--regenerate`.
The input arguments to these commands are expected to change to
support copilot-style functionality in the near future.
* gptel-transient.el (gptel-menu, gptel--suffix-send,
gptel--regenerate):
Change the transient menu layout to be more compact (with a newly
added column.) When overwriting the prompt with a response, save
the prompt to the gptel response's history. Add
`gptel--regenerate` to regenerate a response. This is accessible
from the transient menu when the point is inside response text.
* gptel-transient.el (gptel--suffix-system-message): Mark the
whole directive when editing it in the `*gptel-system*` buffer.
Previously only the first line of the directive was being marked.
* gptel.el (gptel-request): Update docstring to clarify what
BUFFER and POSITION do. Addresses #191.
* gptel-transient.el (gptel-menu, gptel--suffix-send): Replace
"new session" and "existing session" redirection options with
"gptel session" and "any buffer", allowing for more flexibility
when redirecting. "gptel session" can be an existing or new
session. Fix bug where the prompt was generated from the contents
of the destination buffer instead of the current buffer when
redirecting to a gptel session. Add comments demarcating blocks
in `gptel--suffix-send`.
* gptel-transient.el (gptel-menu): Sanitize model if it's not in
the backend.
* gptel.el (gptel--sanitize-model): New helper.
* gptel.el (gptel-send): Also sanitize model in non-prefixed gptel-send.
* gptel-transient.el (gptel-system-prompt--setup): (Tentative
change) Show descriptions of directives next to the keys when
picking a directive from the system-prompt menu.
* gptel-transient.el (gptel-menu, gptel--suffix-send): Add a
transient menu option to select the prompt from the kill-ring.
By default the latest kill is selected. Sending with a prefix-arg
allows for choosing the kill ring element.
TODO: This latter behavior needs to be made discoverable somehow.
* gptel.el (gptel-default-session, gptel): Name the gptel buffer
according to the default backend. Delete the variable
`gptel-default-session`. Fix#174.
* gptel-openai.el (gptel-make-openai): Don't specify a key by
default. Fix#170.
* gptel-transient.el (gptel--suffix-system-message): Explicitly
set the :transient slot of the system-message editor commands to
`transient--do-exit` (#157).
* gptel-transient.el (gptel-system-prompt--setup): In Transient
v0.5 and up, some suffixes defined dynamically using
`gptel-system-prompt--setup' are being treated as infix commands,
see #140. Set the `:transient' key of these suffixes to
`transient--do-return' explicitly to avoid this problem. TODO:
This fix will work but it's not clear why this is needed, this
needs some investigation.
* gptel-transient.el (gptel--suffix-send): When creating a new
session to redirect the response to, ensure that gptel-model is
set correctly in that buffer.
README: Mention `gptel-update-destination` in README.
gptel.el (gptel-update-destination, gptel--update-status,
gptel-send, gptel--insert-response): New option
`gptel-update-destination` to control how gptel's status messages
are shown. `gptel--update-status` replaces
`gptel--update-header-line`. Replace calls to this function
elsewhere in gptel.el.
gptel-curl.el (gptel-abort, gptel-curl--stream-cleanup,
gptel-curl--stream-insert-response): Use `gptel--update-status` in
place of `gptel--update-header-line`.
gptel-transient.el (gptel--suffix-send): Use
`gptel--update-status` in place of `gptel--update-header-line`.
* gptel-transient.el (gptel--suffix-system-message): Improve the
editing prompt for custom suffixes. Unset the "C-c C-c" and "C-c
C-k" keys from text-mode. FIXME: This is fragile, instead add the
keymap with these keys as a sticky text-property over the text.
gptel-transient.el (gptel--suffix-system-message): Removing the
`(setf (buffer-local-value ...))` construct (as instructed to by
the byte compiler) introduced a bug where custom system message
were set from the wrong buffer. Handle this correctly to fix#138
and possibly #140.
* gptel.el (gptel--at-word-end, gptel-send, gptel-request):
Include the word the cursor is on in the prompt, and don't break
it when inserting the response. This is primarily useful for
evil-mode users who frequenty end up one char before the end of a
word when they switch to normal-mode.
* gptel-transient.el (gptel-send): Same. Also fix bug with
selecting an existing buffer to send the response to.
gptel.el (gptel--get-api-key, gptel, gptel-mode,
gptel-make-openai, gptel-api-key-from-auth-source): Handle models
that don't require an API key.
gptel-transient.el (gptel--suffix-system-message): Set backend
from buffer-local value when invoking, and handle API key
requirement better.
README.org: Update README with new information and a multi-llm demo.
gptel.el (gptel-host, gptel--known-backends, gptel--api-key,
gptel--create-prompt, gptel--request-data, gptel--parse-buffer, gptel-request,
gptel--parse-response, gptel--openai, gptel--debug, gptel--restore-state,
gptel, gptel-backend):
Integrate multiple LLMs through the introcution of gptel-backends. Each backend
is composed of two pieces:
1. An instance of a cl-struct, containing connection, authentication and model
information. See the cl-struct `gptel-backend` for details. A separate
cl-struct type is defined for each supported backend (OpenAI, Azure, GPT4All and
Ollama) that inherits from the generic gptel-backend type.
2. cl-generic implementations of specific tasks, like gathering up and
formatting context (previous user queries and LLM responses), parsing responses
or responses streams etc. The four tasks currently specialized this way are
carried out by `gptel--parse-buffer` and `gptel--request-data` (for constructing
the query) and `gptel--parse-response` and `gptel-curl--parse-stream` (for
parsing the response). See their implementations for details. Some effort has
been made to limit the number of times dispatching is done when reading
streaming responses.
When a backend is created, it is registered in the collection
`gptel--known-backends` and can be accessed by name later, such as from the
transient menu.
Only one of these backends is active at any time in a buffer, stored in the
buffer-local variable `gptel-backend`. Most messaging, authentication etc
accounts for the active backend, although there might be some leftovers.
When using `gptel-request` or `gptel-send`, the active backend can be changed or
let-bound.
- Obsolete `gptel-host`
- Fix the rear-sticky property when restoring sessions from files.
- Document some variables (not user options), like `gptel--debug`
gptel-openai.el (gptel-backend, gptel-make-openai, gptel-make-azure,
gptel-make-gpt4all): This file (currently always loaded) sets up the generic
backend struct and includes constructors for creating OpenAI, GPT4All and Azure
backends. They all use the same API so a single set of defgeneric
implemenations suffices for all of them.
gptel-ollama.el (gptel-make-ollama): This file includes the cl-struct,
constructor and requisite defgeneric implementations for Ollama support.
gptel-transient.el (gptel-menu, gptel-provider-variable, gptel--infix-provider,
gptel-suffix-send):
- Provide access to all available LLM backends and models from `gptel-menu`.
- Adjust keybindings in gptel-menu: setting the model and query parameters is
now bound to two char keybinds, while redirecting input and output is bound to
single keys.
* gptel.el (gptel-crowdsourced-prompts-file): This file holds
prompts compiled by the community.
* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--crowdsourced-prompts, gptel-system-prompt--setup,
gptel--crowdsourced-prompts-url): Fetch crowdsourced system
prompts from https://github.com/f/awesome-chatgpt-prompts and pick
one to use from the transient menu.
* gptel.el (gptel-directives): Bump required transient version to
0.4.0. Remove placeholder about hard-coded directives from
the docstring for `gptel-directives'.
* gptel-transient.el (gptel-system-prompt,
gptel-system-prompt--setup): Dynamically generate the system
prompt menu in `gptel-menu'. Delete helper functions that
hard-coded the list of system prompts/directives before.
* gptel-transient.el (gptel--system-prompt-programming,
gptel--system-prompt-default, gptel--system-prompt-writing,
gptel--system-prompt-chat, gptel-system-prompt): Define explicit helper
functions to set the system prompt. This is a temporary workaround for #45
until dynamic transients are supported in a new transient release.
* gptel.el (gptel--insert-response):
* gptel-transient.el (gptel--suffix-send):
* gptel-curl.el (gptel-curl--stream-filter, gptel-curl--stream-insert-response,
gptel-curl--stream-cleanup):
Handle read-only gptel buffers by redirecting the output to a new buffer (that
pops up automatically). To track this,
- the `:position' argument of the INFO plist, which is a marker, is moved to the
new output buffer.
- the `:buffer' argument of the INFO plist is unmodified, it always points to
the buffer that the request originated from.
* gptel-transient.el (gptel--suffix-send, gptel-menu): When
reading input from the minibuffer and sending the output to an
existing gptel session, only use the prompt read from the
minibuffer. Reword the "Overwrite/Delete prompt" option.
* gptel.el (gptel): `gptel' only pops to the gptel buffer when
called interactively.
* gptel-transient.el: Pop up the gptel session buffer when the
prompt is sent to it, but don't select it. Also message the user
that the response has been redirected to the gptel session.
* gptel-transient.el (gptel-menu, gptel--suffix-send,
gptel--suffix-send-existing, gptel--suffix-send-new): Rewrite
`gptel-menu' to allow for selecting prompt sources and response
sinks independently. Sensible combinations of the following are
now possible:
- prompt from minibuffer
- Replace prompt with response
- Response to echo area
- Response to new gptel session
- Response to existing gptel session
- Response to kill-ring
The transient suffixes `gptel--suffix-send-existing' and
`gptel--suffix-send-new' are now obsolete and have been removed.
* gptel-transient.el: Add `gptel-rewrite-menu' (accessible via the
main `gptel-menu') to rewrite/refactor the selected region,
including the choice to Ediff it linewise/wordwise afterwards.
* gptel.el (gptel-send): Replace references to `gptel-send-menu'.
* gptel-transient.el: Rename `gptel-send-menu' t `gptel-menu'.
This shorter name is apropos of its increased feature set (in the
forthcoming commits).
* gptel.el (gptel--request-data, gptel--system-message-alist,
gptel--model, gptel--temperature, gptel--max-tokens): Rename API
parameters and turn them into customizable variables. They are
still buffer-local.
Rename:
`gptel--system-message-alist' to `gptel-directives'
`gptel--max-tokens' to `gptel-max-tokens'
`gptel--model' to `gptel-model'
`gptel--temperature' to `gptel-temperature'
* gptel-transient.el (gptel-system-prompt,
gptel--infix-max-tokens, gptel--infix-model,
gptel--infix-temperature): Accommodating changes when setting the
renamed parameters.
gptel-transient.el (gptel-send-menu, gptel--suffix-send-existing,
gptel--suffix-send-new, gptel--infix-model): Make menu keybindings
more uniform and improve descriptions. Suffixes to send queries in
existing/new sessions will now automatically send them instead of
just yanking the text into these sessions.