Built in capability to summarize chat to provide it a title and/or buffer name #363
petergaultney
started this conversation in
Ideas
Replies: 1 comment
-
To be clear, you can do this quite fast from gptel's transient menu. Not one key, but the whole request can be fashioned in under ten seconds and you can access the settings again by opening the menu and hitting C-M-p. But anyway, you can use (defvar my/gptel-summary-length 300
"Word limit for gptel transcript summary.")
(defun my/gptel-summarize-cheaply ()
"Summarize text of current buffer using gptel."
(interactive)
(let ((gptel-backend (alist-get "ChatGPT" gptel--known-backends
nil nil #'equal))
(gptel-model "gpt-3.5-turbo")
(gptel-max-tokens (* 3 my/gptel-summary-length)))
(gptel-request (buffer-string)
:system (format "Summarize this LLM conversation transcript in %d or fewer words."
my/gptel-summary-length)
:callback (lambda (response info)
(if response
(with-current-buffer (get-buffer-create "*gptel-summary*")
(let ((inhibit-read-only t))
(erase-buffer)
(visual-line-mode 1)
(save-excursion (insert response))
(fill-region (point-min) (point-max)))
(special-mode)
(setq header-line-format
(format "gptel summary for buffer: %s"
(buffer-name
(plist-get info :buffer))))
(display-buffer (current-buffer)
'(display-buffer-in-side-window
(side . bottom)
(window-height . 0.3))))
(message "Response failed with status: %S" (plist-get info :status))))))) See also gptel-quick. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i've used slickgpt in the past (a web page that just hosts conversations with LLMs), and I really liked its ability to send the whole text of the conversation back to a different, cheaper LLM (usually gpt 3.5 in my case) to get a summary for the whole chat at the end.
I would love to have the ability to do this with a single keystroke. Likely, it could be done in elisp outside of gptel itself (just using gptel's capabilities), but I'm not much of an elisp person, so I am asking about it here instead. :)
Beta Was this translation helpful? Give feedback.
All reactions