Closed aindilis closed 1 month ago
You can use gptel-prompt-prefix-alist
and gptel-response-prefix-alist
to add text before a response/prompt. This is intended for use in gptel chat buffers. See #103 for an example.
A more general solution is to use gptel-pre-response-hook
and gptel-post-response-functions
to add this stuff. Here is an example:
(defun gptel-tag-response (beg end)
(save-excursion
(goto-char end)
;; ending tag
(insert "</llm-content>\n\n<llm-prompt>")
(goto-char beg)
(skip-chars-backward " \n\r\t")
;; end of prompt tag
(insert "</llm-prompt>")
(skip-chars-forward " \n\r\t")
;; beginning of response tag
(insert (format "<llm-content model=\"%s\">\n"
gptel-model))))
(add-hook 'gptel-post-response-functions #'gptel-tag-response)
Modify as needed.
Closing this now, please reopen if the above solution doesn't work.
Hi,
I was wondering whether some feature such as the following could be implemented:
1) Inserting perhaps XML or Org-mode tags indicating the beginning and ending of LLM generated content.
E.g.
Would become
2) Making such context sensitive, so it would use the appropriate tags for the mode, e.g. Org-mode, or comment them out:
(in hypothetical file: apartments.el)
Thanks!
Andrew