8 releases (5 breaking)
0.11.2 | Sep 5, 2024 |
---|---|
0.11.1 | Mar 19, 2024 |
0.11.0 | Feb 2, 2024 |
0.10.0 | Jan 27, 2024 |
0.6.0 | May 3, 2023 |
#127 in Machine learning
87 downloads per month
485KB
2K
SLoC
Tenere
TUI interface for LLMs written in Rust
đ¸ Demo
đĒ Featues
- Syntax highlights
- Chat history
- Save chats to files
- Vim keybinding (most common ops)
- Copy text from/to clipboard (works only on the prompt)
- Multiple backends
đ Supported Backends
- ChatGPT
- llama.cpp
- ollama
đ Installation
đĨ Binary releases
You can download the pre-built binaries from the release page
đĻ crates.io
tenere
can be installed from crates.io
cargo install tenere
âī¸ Build from source
To build from the source, you need Rust compiler and Cargo package manager.
Once Rust and Cargo are installed, run the following command to build:
cargo build --release
This will produce an executable file at target/release/tenere
that you can copy to a directory in your $PATH
.
âī¸ Configuration
Tenere can be configured using a TOML configuration file. The file should be located in :
- Linux :
$HOME/.config/tenere/config.toml
or$XDG_CONFIG_HOME/tenere/config.toml
- Mac :
$HOME/Library/Application Support/tenere/config.toml
- Windows:
~/AppData/Roaming/tenere/config.toml
General settings
Here are the available general settings:
archive_file_name
: the file name where the chat will be saved. By default it is set totenere.archive
llm
: the llm model name. Possible values are:chatgpt
llamacpp
ollama
archive_file_name = "tenere.archive"
llm = "chatgpt"
Key bindings
Tenere supports customizable key bindings.
You can modify some of the default key bindings by updating the [key_bindings]
section in the configuration file.
Here is an example with the default key bindings
[key_bindings]
show_help = '?'
show_history = 'h'
new_chat = 'n'
save_chat = 's'
âšī¸ Note
To avoid overlapping with vim key bindings, you need to use
ctrl
+key
except for help?
.
Chatgpt
To use chatgpt
as the backend, you'll need to provide an API key for OpenAI. There are two ways to do this:
Set an environment variable with your API key:
export OPENAI_API_KEY="YOUTR KEY HERE"
Or
Include your API key in the configuration file:
[chatgpt]
openai_api_key = "Your API key here"
model = "gpt-3.5-turbo"
url = "https://api.openai.com/v1/chat/completions"
The default model is set to gpt-3.5-turbo
. Check out the OpenAI documentation for more info.
llama.cpp
To use llama.cpp
as the backend, you'll need to provide the url that points to the server :
[llamacpp]
url = "http://localhost:8080/v1/chat/completions"
If you configure the server with an api key, then you need to provide it as well:
Setting an environment variable :
export LLAMACPP_API_KEY="YOUTR KEY HERE"
Or
Include your API key in the configuration file:
[llamacpp]
url = "http://localhost:8080/v1/chat/completions"
api_key = "Your API Key here"
More infos about llama.cpp api here
Ollama
To use ollama
as the backend, you'll need to provide the url that points to the server with the model name :
[ollama]
url = "http://localhost:11434/api/chat"
model = "Your model name here"
More infos about ollama api here
â¨ī¸ Key bindings
Global
These are the default key bindings regardless of the focused block.
ctrl + n
: Start a new chat and save the previous one in history.
ctrl + s
: Save the current chat or chat history (history pop-up should be visible first) to tenere.archive
file in the current directory.
Tab
: Switch the focus.
j
or Down arrow key
: Scroll down
k
or Up arrow key
: Scroll up
ctrl + h
: Show chat history. Press Esc
to dismiss it.
ctrl + t
: Stop the stream response
q
or ctrl + c
: Quit the app
?
: Show the help pop-up. Press Esc
to dismiss it
Prompt
There are 3 modes like vim: Normal
, Visual
and Insert
.
Insert mode
Esc
: to switch back to Normal mode.
Enter
: to create a new line.
Backspace
: to remove the previous character.
Normal mode
Enter
: to submit the prompt
h or Left
: Move the cursor backward by one char.
j or Down
: Move the cursor down.
k or Up
: Move the cursor up.
l or Right
: Move the cursor forward by one char.
w
: Move the cursor right by one word.
b
: Move the cursor backward by one word.
0
: Move the cursor to the start of the line.
$
: Move the cursor to the end of the line.
G
: Go to the end.
gg
: Go to the top.
a
: Insert after the cursor.
A
: Insert at the end of the line.
i
: Insert before the cursor.
I
: Insert at the beginning of the line.
o
: Append a new line below the current line.
O
: Append a new line above the current line.
x
: Delete one char under to the cursor.
dd
: Cut the current line
D
: Delete the current line and
dw
: Delete the word next to the cursor.
db
: Delete the word on the left of the cursor.
d0
: Delete from the cursor to the beginning of the line.
d$
: Delete from the cursor to the end of the line.
C
: Change to the end of the line.
cc
: Change the current line.
c0
: Change from the cursor to the beginning of the line.
c$
: Change from the cursor to the end of the line.
cw
: Change the next word.
cb
: Change the word on the left of the cursor.
u
: Undo
p
: Paste
Visual mode
v
: Switch to visual.
y
: Yank the selected text
âī¸ License
GPLv3
Dependencies
~27â44MB
~724K SLoC