chat.el
is an pure Emacs package for interacting with OpenAI's ChatGPT models such as GPT3. It interacts directly with the OpenAI API vie Emac's built-in url
package.
It offers several helpful features that enable users to perform, such as writing this README for me. Functionality can be broken down into two basic categories.
The package offers different ways of querying the ChatGPT model based on user input and region selection, which include:
chat-query-user
: Query ChatGPT's response to a user-specified input, either displaying or inserting it.chat-query-region
: Sends the active region to ChatGPT for responses relevant to the content.chat-query-dwim
: A prompt for querying ChatGPT prompts users to either specify a region of text or ask for machine learning recommendations based on a prompt.
A chat-mode
allows users to communicate with the ChatGPT model in a "conversation-like" format with prompts. To start an interactive session, run chat
.
The package also supports custom.el
, facilitating configuration of API keys and user-specific settings.
In the configuration section, chat-api-env-key
set the environmental variable used to look up an API key if not specified, while chat-api-key
sets the OpenAI API key directly.
-
chat-max-tokens
sets the maximum number of tokens for ChatGPT to return for a single request. -
chat-system-prompt
sets the system prompt given to all ChatGPT requests. -
chat-user-prompt
sets the text prompt for by the user when inchat-mode
. Defaults to"You > "
. -
chat-bot-prompt
sets the prompt faced by the AI inchat-mode
. Defaults to"Bot > "
. -
chat-tempature
sets thetempature
parameter for requests. Defaults tonil
. -
chat-top-p
sets thetop_p
parameter for requests. Defaults tonil
.
To install chat.el
, follow these simple steps:
-
Download "chat.el" file to your machine.
-
In your Emacs configuration file, add this line:
(add-to-list 'load-path "/path/to/chat.el/directory")
-
Evaluating
(require 'chat)
in emacs will load the package. -
If you want to give a custom configuration, add your configuration to your emacs configuration file.
To configure this package, customize chat-mode
to control the Chat GPT interaction behavior.