TUI to interact with GPT models.
gpttui provides a terminal frontend that allows sessions (conversations) with LLMs, stores all the information in a centralized database, and provides vi-like keybindings.
Note: It currently supports OpenAI, ChatSonic, and ColossalAI (it seems like they terminated the server, so you'll need to use other deployed endpoint).
You can install gpttui with pip:
pip install gpttuisession: a conversation (chat).context: specifies a topic or a specialization for the assistant.user: the person that usesgpttui.assistant: the AI assistant.
You can get more information using the help page:
gpttui --helpYou have the following options:
First, you need to set up the configuration files:
gpttui init --model_kind OPENAI --model_config openai.jsonThis will generate the configuration files in the default configuration folder $HOME/.config/gpttui:
.config/gpttui
├── keybindings.json
├── openai.json
└── style.csskeybindings.jsonspecifies the keybindings to use in the app.style.cssdefines the app's theme.openai.jsonis the configuration file for OpenAI models.
For OpenAI, you need to generate an API key and extract the organization ID; you must replace these values in the openai.json file:
{
"timeout": 30,
"max_retries": 3,
"model_name": "gpt-3.5-turbo",
"organization": "ORGANIZATION ID",
"api_key": "API KEY"
}You can also specify the maximum timeout for a response, the maximum number of retries max_retries, and which model to use model_name.
Use the following command to launch gpttui using the OpenAI configuration:
gpttui front \
--model_kind OPENAI \
--model_config openai.json \
--database_kind SQLITE \
--database_name db.sqlite \
--context "You're an expert python developer." \
--session python_devIn this case, we create the db.sqlite database in SQLite, the session (conversation) python_dev is initialized for the given context.
Note: You can recover the conversation by using the same session name. By default, the
SQLitedatabase is created in the default config folder.
First, you need to set up the configuration files:
gpttui init --model_kind COLOSSAL --model_config colossal.jsonThis will generate the configuration files in the default configuration folder $HOME/.config/gpttui:
.config/gpttui
├── keybindings.json
├── colossal.json
└── style.cssFor Colossal, you can configure the following values in the colossal.json file:
{
"url": "https://service.colossalai.org/generate",
"repetition_penalty": 1.2,
"top_k": 40,
"top_p": 0.5,
"temperature": 0.7,
"max_new_tokens": 512,
"timeout": 30
}Use the following command to launch gpttui using the OpenAI configuration:
gpttui front \
--model_kind COLOSSAL \
--model_config colossal.json \
--database_kind SQLITE \
--database_name db.sqlite \
--session colossal_testIn this case, the db.sqlite database is created (or reused if already created) in SQLite, and the session (conversation) colossal_test is initialized for the given context.
Note: You can recover the conversation by using the same session name. By default, the
SQLitedatabase is created in the default configuration folder.
First, you need to set up the configuration files:
gpttui init --model_kind CHATSONIC --model_config chatsonic.jsonThis will generate the configuration files in the default configuration folder $HOME/.config/gpttui:
.config/gpttui
├── keybindings.json
├── chatsonic.json
└── style.cssFor ChatSonic, you can configure the following values in the chatsonic.json file:
{
"url": "https://api.writesonic.com/v2/business/content/chatsonic?engine=premium",
"api_key": "",
"enable_memory": true,
"enable_google_results": true
}You must insert your ChatSonic API KEY into the api_key value.
Use the following command to launch gpttui using the ChatSonic configuration:
gpttui front \
--model_kind CHATSONIC \
--model_config chatsonic.json \
--database_kind SQLITE \
--database_name db.sqlite
--session chatsonic_testIn this case, the db.sqlite database is created (or reused if already created) in sqlite, and the session (conversation) chatsonic_test is initialized for the given context.
Note: You can recover the conversation by using the same session name. By default, the
sqlitedatabase is created in the default configuration folder.
gpttui has two modes:
-
NORMAL: In this mode, you can perform global operations. By default, theNORMALmode has the following keybindings:c: Clear messages.d: Delete prompt.q: Quit.y: Yank/copy the last message from the assistant.p: Paste some text from the clipboard into the prompt.i: Switch to insert mode.
-
INSERT: In this mode, you can enter text in the prompt. By default, theINSERTmode has the following keybindings:esc: Switch to normal mode.enter: Send text to the assistant.
You can modify the keybindings in the keybindings.json file located at .config/gpttui/.
gpttui is stylized through textual css. You can modify the style.css file located at .config/gpttui.
