Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!

Overview

Oatmeal

oatmeal

Build Status Release Coverage Status

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!

Overview

Oatmeal is a terminal UI chat application that speaks with LLMs, complete with slash commands and fancy chat bubbles. It features agnostic backends to allow switching between the powerhouse of ChatGPT, or keeping things private with Ollama. While Oatmeal works great as a stand alone terminal application, it works even better paired with an editor like Neovim!

See it in action with Neovim (click to restart):

oatmeal-demo

Note: This project is still quite new, and LLM's can return unexpected answers the UI isn't prepped for. There's likely a few bugs hidden somewhere.

Install

MacOS

brew install dustinblackman/tap/oatmeal

Debian / Ubuntu

curl -s https://apt.dustinblackman.com/KEY.gpg | apt-key add -
curl -s https://apt.dustinblackman.com/dustinblackman.list > /etc/apt/sources.list.d/dustinblackman.list
sudo apt-get update
sudo apt-get install oatmeal

Fedora / CentOS

dnf config-manager --add-repo https://yum.dustinblackman.com/config.repo
dnf install oatmeal

Nix

nix-env -f '<nixpkgs>' -iA nur.repos.dustinblackman.oatmeal

Arch Linux

yay -S oatmeal-bin

Windows

Chocolatey

Coming soon! Waiting on first version approval.

Scoop

scoop bucket add dustinblackman https://github.com/dustinblackman/scoop-bucket.git
scoop install oatmeal

Cargo

cargo install oatmeal

Manual

Download the pre-compiled binaries and packages from the releases page and copy to the desired location.

Source

git clone https://github.com/dustinblackman/oatmeal.git
cd oatmeal
cargo build --release
mv ./target/release/oatmeal /usr/local/bin/

Usage

Oatmeal allows customizing configuration either through command line parameters, or more permanently with environment variables. By default, Ollama is the selected backend, llama2:latest as the default model, and the clipboard integration for an editor. See oatmeal --help, /help in chat, or the output below to get all the details.

Terminal UI to chat with large language models (LLM) using different model backends, and direct integrations with your favourite editors!

Version: 0.6.1
Commit: v0.6.1

Usage: oatmeal [OPTIONS] [COMMAND]

Commands:
  chat         Start a new chat session
  completions  Generates shell completions
  sessions     Manage past chat sessions
  help         Print this message or the help of the given subcommand(s)

Options:
  -b, --backend <backend>            The initial backend hosting a model to connect to. [Possible values: ollama, openai] [env: OATMEAL_BACKEND=] [default: ollama]
  -m, --model <model>                The initial model on a backend to consume [env: OATMEAL_MODEL=] [default: llama2:latest]
  -e, --editor <editor>              The editor to integrate with. [Possible values: clipboard, neovim] [env: OATMEAL_EDITOR=] [default: clipboard]
  -t, --theme <theme>                Sets code syntax highlighting theme. [Possible values: base16-github, base16-monokai, base16-one-light, base16-onedark, base16-seti] [env: OATMEAL_THEME=] [default: base16-onedark]
      --theme-file <theme-file>      Absolute path to a TextMate tmTheme to use for code syntax highlighting [env: OATMEAL_THEME_FILE=]
      --openai-url <openai-url>      OpenAI API URL when using the OpenAI backend. Can be swapped to a compatiable proxy [env: OATMEAL_OPENAI_URL=] [default: https://api.openai.com]
      --openai-token <openai-token>  OpenAI API token when using the OpenAI backend [env: OATMEAL_OPENAI_TOKEN=]
  -h, --help                         Print help
  -V, --version                      Print version

CHAT COMMANDS:
  - /modellist (/ml) - Lists all available models from the backend.
  - /model (/model) [MODEL_NAME,MODEL_INDEX] - Sets the specified model as the active model. You can pass either the model name, or the index from /modellist
  - /append (/a) [CODE_BLOCK_NUMBER?] - Appends code blocks to an editor. See Code Actions for more details.
  - /replace (/r) [CODE_BLOCK_NUMBER?] - Replaces selections with code blocks in an editor. See Code Actions for more details.
  - /copy (/c) [CODE_BLOCK_NUMBER?] - Copies the entire chat history to your clipboard. When a CODE_BLOCK_NUMBER is used, only the specified copy blocks are copied to clipboard. See Code Actions for more details.
  - /quit /exit (/q) - Exit Oatmeal.
  - /help (/h) - Provides this help menu.

CHAT HOTKEYS:
  - Up arrow - Scroll up
  - Down arrow - Scroll down
  - CTRL+U - Page up
  - CTRL+D - Page down
  - CTRL+C - Interrupt waiting for prompt response if in progress, otherwise exit.
  - CTRL+R - Resubmit your last message to the backend.

CHAT CODE ACTIONS:
When working with models that provide code, and using an editor integration, Oatmeal has the capabilities to read selected code from an editor, and submit model provided code back in to an editor. Each code block provided by a model is indexed with a (NUMBER) at the beginning of the block to make it easily identifiable.

  - /append (/a) [CODE_BLOCK_NUMBER?] will append one-to-many model provided code blocks to the open file in your editor.
  - /replace (/r) [CODE_BLOCK_NUMBER?] - will replace selected code in your editor with one-to-many model provided code blocks.
  - /copy (/c) [CODE_BLOCK_NUMBER?] - will append one-to-many model provided code blocks to your clipboard, no matter the editor integration being used.

The CODE_BLOCK_NUMBER allows you to select several code blocks to send back to your editor at once. The parameter can be set as follows:
  - `1` - Selects the first code block
  - `1,3,5` - Selects code blocks 1, 3, and 5.
  - `2..5`- Selects an inclusive range of code blocks between 2 and 5.
  - None - Selects the last provided code block.

Backends

The following model backends are supported:

Editors

The following editors are currently supported. The clipboard editor is a special case where any copy or accept commands are simply copied to your clipboard. This is the default behaviour.

Themes

A handful of themes are embedded in the application for code syntax highlighting, defaulting to OneDark. If none suits your needs, Oatmeal supports any Sublime Text/Text Mate .tmTheme file, which can be configured through the --theme-file command line parameter, or the OATMEAL_THEME_FILE environment variable. base16-textmate has plenty to pick from!

Sessions

Oatmeal persists all chat sessions with your models, allowing you to go back and review an old conversation, or pick up from where you left off!

Manage past chat sessions

Usage: oatmeal sessions [OPTIONS] [COMMAND]

Commands:
  dir     Print the sessions cache directory path
  list    List all previous sessions with their ids and models
  open    Open a previous session by ID. Omit passing any session ID to load an interactive selection
  delete  Delete one or all sessions
  help    Print this message or the help of the given subcommand(s)

Options:
  -e, --editor <editor>              The editor to integrate with. [Possible values: clipboard, neovim] [env: OATMEAL_EDITOR=] [default: clipboard]
  -t, --theme <theme>                Sets code syntax highlighting theme. [Possible values: base16-github, base16-monokai, base16-one-light, base16-onedark, base16-seti] [env: OATMEAL_THEME=] [default: base16-onedark]
      --theme-file <theme-file>      Absolute path to a TextMate tmTheme to use for code syntax highlighting [env: OATMEAL_THEME_FILE=]
      --openai-url <openai-url>      OpenAI API URL when using the OpenAI backend. Can be swapped to a compatiable proxy [env: OATMEAL_OPENAI_URL=] [default: https://api.openai.com]
      --openai-token <openai-token>  OpenAI API token when using the OpenAI backend [env: OATMEAL_OPENAI_TOKEN=]
  -h, --help                         Print help

Grepping through previous sessions isn't something built in to Oatmeal (yet). This bash function can get you there nicely using Ripgrep and FZF.

function oatmeal-sessions() {
    current=$(pwd)

    cd "$(oatmeal sessions dir)"
    id=$(rg --color always -n . | fzf --ansi | awk -F ':' '{print $1}' | head -n1 | awk -F '.' '{print $1}')
    oatmeal sessions open --id "$id"

    cd $current
}

Contributing

Report an issue

On each Oatmeal release there is a separate download to helps in reporting issues to really drill down in to what the problem is! If you've run in to a problem, I'd really help appreciate solving it.

  1. Head over to releases and download the DEBUG package for your system and version of Oatmeal you're using.
  2. Extract the contents of the archive next to your oatmeal binary. You can find it on your system by running something equivalent to which oatmeal.
  3. Run your command with the arguments provided in the error message.
  4. Copy/paste the output and open an issue.

Development

Setup

The following will get you set up with all the necessary tooling to work on Oatmeal.

cargo install cargo-run-bin
git clone https://github.com/dustinblackman/oatmeal.git
cd oatmeal
cargo cmd setup

Adding a backend

Each backend implements the Backend trait in its own infrastructure file. The trait has documentation on what is expected of each method. You can checkout Ollama as an example.

The following steps should be completed to add a backend:

  1. Implement trait for new backend.
  2. Update the BackendManager to provide your new backend.
  3. Write tests
  4. Update the documentation for the CLI.

Adding an editor

Each editor implements the Editor trait in its own infrastructure file. The trait has documentation on what is expected of each method. You can checkout Neovim as an example.

The following steps should be completed to add an editor:

  1. Implement trait for new editor.
  2. Update the EditorManager to provide your new editor.
  3. Write tests
  4. Update the documentation for the CLI.

Adding syntax highlighting for a language

Syntax highlighting language selection is a tad manual where several languages must be curated and then added to build.rs.

  1. Google to find a .sublime-syntax project on Github for your language. bat has many!
  2. Update the get_syntaxes() function in build.rs to include the new repo. Make sure to set the URL to a commit locked .tar.gz file, and to include the license in the files vector.
  3. rm -rf .caches && cargo build
  4. Test to see highlighting works.

FAQ

Why Oatmeal?

I was eating a bowl of oatmeal when I wrote the first commit 🤷. (They don't let me name things at work anymore...)

License

MIT

Comments
Releases(v0.6.1)
Owner
Dustin Blackman
Senior Staff Software Engineering Lead
Dustin Blackman
Slack chat bot written in Rust that allows the user to interact with a large language model.

A Slack chat bot written in Rust that allows the user to interact with a large language model. Creating an App on Slack, first steps Go to https://api

Marco Inacio 13 Nov 2, 2023
🧰 Download pre-built binaries of all your favourite tools with a single command

tool-sync tool-sync is a CLI tool that solves one problem: ?? Download pre-built binaries of all your favourite tools with a single command. tool-sync

Dmitrii Kovanikov 50 Jan 1, 2023
Attempt to summarize text from `stdin`, using a large language model (locally and offline), to `stdout`

summarize-cli Attempt to summarize text from stdin, using a large language model (locally and offline), to stdout. cargo build --release target/releas

null 4 Aug 23, 2023
Solving context limits when working with AI LLM models by implementing a "chunkable" attribute on your prompt structs.

Promptize Promptize attempts to solve the issues with context limits when working with AI systems. It allows a user to add an attribute to their struc

Dan Nelson 5 Jul 18, 2023
Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.

What is Tight Model Format The main goal of the tmf project is to provide a way to save 3D game assets compressed in such a way, that there are no not

null 59 Mar 6, 2023
🦀Rust + Large Language Models - Make AI Services Freely and Easily. Inspired by LangChain

llmchain: Modern Data Transformations with LLM ?? + Large Language Models, inspired by LangChain. Features Models: LLMs & Chat Models & Embedding Mode

Shafish Labs 63 Jun 22, 2023
Cloud Native Buildpack that builds an OCI image with Ollama and a large language model.

Ollama Cloud Native Buildpack This buildpack builds an OCI image with Ollama and a large language model. Configure your model by an Ollama Modelfile o

Manuel Fuchs 3 Mar 19, 2024
High-performance, low-level framework for composing flexible web integrations

High-performance, low-level framework for composing flexible web integrations. Used mainly as a dependency of `barter-rs` project

Barter 8 Dec 28, 2022
A rust crate for rendering large text to the terminal using font8x8 and ratatui.

tui-big-text tui-big-text is a rust crate that renders large pixel text as a ratatui widget using the glyphs from the font8x8 crate. Installation carg

Josh McKinney 7 Sep 7, 2023
TUI input library supporting multiple backends

tui-input WARNING: Most of the functionality is only human tested. A TUI input library supporting multiple backends. This crate can be used with tui-r

Arijit Basu 36 Dec 19, 2022
A CLI tool to copy-paste different Ipsums from your terminal

Lorem clipsum Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About The Project Built With Usage Contributing Contact Ab

Schrödinger Hat 9 May 30, 2023
Twitch chat in the terminal.

Twitch Chat IRC, in the terminal. What it looks like: Keybinds: Normal mode Key Description ? Have the keybinds window appear. i Enter insert mode for

null 172 Dec 30, 2022
Twitch chat in the terminal.

Twitch chat in the terminal. What it looks like: Keybinds: Normal mode Key Description c Go to the chat window chat. i Enter input mode for sending me

null 176 Jan 5, 2023
Harmony chat client in the terminal!

ilo-toki Harmony chat client in the terminal! Usage Run it with cargo run once you've cloned the repo. If you'd like, you can install the program with

jan Jenwa 2 Dec 15, 2022
Terminal UI for leetcode. Lets you browse questions through different topics. View, solve, run and submit questions from TUI.

Leetcode TUI Use Leetcode in your terminal. Why this TUI: My motivation for creating leetcode-tui stemmed from my preference for tools that are lightw

Akarsh 8 Aug 10, 2023
Rust library for integrating local LLMs (with llama.cpp) and external LLM APIs.

Table of Contents About The Project Getting Started Roadmap Contributing License Contact A rust interface for the OpenAI API and Llama.cpp ./server AP

Shelby Jenkins 4 Dec 18, 2023
hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes

hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes (NULL bytes, printable ASCII characters, ASCII whitespace characters, other ASCII characters and non-ASCII).

David Peter 7.3k Dec 29, 2022
An LLM-powered (CodeLlama or OpenAI) local diff code review tool.

augre An LLM-powered (CodeLlama or OpenAI) local diff code review tool. Binary Usage Install Windows: $ iwr https://github.com/twitchax/augre/releases

Aaron Roney 4 Oct 19, 2023
An egui app for prompting a local offline LLM.

An egui app for prompting a local offline LLM. Description coze is a small egui application for prompting a local offline LLM using the Huggingface ca

null 23 Mar 9, 2024