Extra functions for gptel, a package that allows you to use OpenAI's GPT for text generation and completion directly from Emacs.
Clone the repository to a local directory with:
git clone https://github.com/kamushadenes/gptel-extensions.el.git
Add the following to your Emacs init file (usually ~/.emacs
or ~/.emacs.d/init.el
):
(add-to-list 'load-path "path/to/gptel-extensions")
(require 'gptel-extensions)
Replace path/to/gptel-extensions
with the path where you cloned the repository.
Restart Emacs, or evaluate the added code with M-x eval-buffer
while in the init file.
gptel-extensions-send-whole-buffer
Send the whole buffer to ChatGPT.
gptel-extensions-ask-document
Load the current buffer into a session so you can ask questions about it.
gptel-extensions-rewrite-and-replace
Rewrite the region or sentence at point and replace it with the response. Extracted from the Wiki.
gptel-extensions-refactor
Refactor the region or sentence at point.
gptel-extensions-ask-document-prefix
Prefix to use when asking questions about a document. Defaults to:
Your task is to answer questions about the following document. If you don't know the answer, reply with "I don't know"
###### DOCUMENT START ######
gptel-extensions-ask-document-suffix
Suffix to use when asking questions about a document. Defaults to:
###### DOCUMENT END ######
### Question:
gptel-extensions-refactor-directive
Directive to use when refactoring code. Defaults to:
You are a programmer. Refactor my code to improve readability. Reply only with the code.
This merely extends the amazing gptel by Karthik Chikmagalur, who performed all the hard work.