parllama


Nameparllama JSON
Version 0.3.10 PyPI version JSON
download
home_pageNone
SummaryTerminal UI for Ollama
upload_time2024-09-25 05:29:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Paul Robello Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ai ollama terminal tui
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PAR LLAMA

## Table of Contents

* [About](#about)
   * [Screenshots](#screenshots)
* [Prerequisites for running](#prerequisites-for-running)
* [Prerequisites for dev](#prerequisites-for-dev)
* [Prerequisites for huggingface model quantization](#prerequisites-for-huggingface-model-quantization)
* [Installing using pipx](#installing-from-mypi-using-pipx)
* [Installing from mypi using pip](#installing-from-mypi-using-pip)
* [Installing for dev mode](#installing-for-dev-mode)
* [Command line arguments](#command-line-arguments)
* [Environment Variables](#environment-variables)
* [Running PAR_LLAMA](#running-par_llama)
    * [with pipx installation](#with-pipx-installation)
    * [with pip installation](#with-pip-installation)
* [Running against a remote instance](#running-against-a-remote-instance)
* [Running under Windows WSL](#running-under-windows-wsl)
    * [Dev mode](#dev-mode)
* [Quick start chat workflow](#quick-start-chat-workflow)
* [Custom Prompts](#Custom-Prompts)
* [Themes](#themes)
* [Screen Help](https://raw.githubusercontent.com/paulrobello/parllama/main/src/parllama/help.md)
* [Contributing](#contributing)
* [FAQ](#faq)
* [Roadmap](#roadmap)
    * [Where we are](#where-we-are)
    * [Where we're going](#where-were-going)
* [What's new](#whats-new)
    * [v0.3.10](#v0310)
    * [v0.3.9](#v039)
    * [v0.3.8](#v038)
    * [v0.3.7](#v037)
    * [v0.3.6](#v036)
    * [v0.3.5](#v035)
    * [v0.3.4](#v034)
    * [v0.3.3](#v033)
    * [v0.3.2](#v032)
    * [v0.3.1](#v031)
    * [v0.3.0](#v030)
    * [v0.2.51](#v0251)
    * [v0.2.5](#v025)

[![PyPI](https://img.shields.io/pypi/v/parllama)](https://pypi.org/project/parllama/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/parllama.svg)](https://pypi.org/project/parllama/)  
![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)
![Arch x86-63 | ARM | AppleSilicon](https://img.shields.io/badge/arch-x86--64%20%7C%20ARM%20%7C%20AppleSilicon-blue)  
![PyPI - License](https://img.shields.io/pypi/l/parllama)

## About
PAR LLAMA is a TUI application designed for easy management and use of Ollama based LLMs.
The application was built with [Textual](https://textual.textualize.io/) and [Rich](https://github.com/Textualize/rich?tab=readme-ov-file)
and runs on all major OS's including but not limited to Windows, Windows WSL, Mac, and Linux.

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/probello3)

## Screenshots
Supports Dark and Light mode as well as custom themes.

![Chat Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/chat_dark_1.png)

![Chat Image Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/chat_image_dark_1.png)

![Local Models Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/local_models_dark_1.png)

![Model View Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/models_view_dark_1.png)

![Site Models Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/site_models_dark_1.png)

![Custom Prompt Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/custom_prompt_dark_1.png)

![Options Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/options_dark_1.png)

![Local Models Light](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/local_models_light_1.png)

## Videos
[V0.3.5 demo](https://www.youtube.com/watch?v=Genv46SKA5o)

## Prerequisites for running
* Install and run [Ollama](https://ollama.com/download)
* Install Python 3.11 or newer
  * [https://www.python.org/downloads/](https://www.python.org/downloads/) has installers for all versions of Python for all os's
  * On Windows the [Scoop](https://scoop.sh/) tool makes it easy to install and manage things like python
    * Install Scoop then do `scoop install python`

## Prerequisites for dev
* Install uv
  * See the [Using uv](#Using-uv) section
* Install GNU Compatible Make command
  * On windows if you have scoop installed you can install make with `scoop install make`

## Prerequisites for huggingface model quantization
If you want to be able to quantize custom models from huggingface, download the following tool from the releases area:
[HuggingFaceModelDownloader](https://github.com/bodaay/HuggingFaceModelDownloader)

Install [Docker Desktop](https://www.docker.com/products/docker-desktop/)

Pull the docker image ollama/quantize
```bash
docker pull ollama/quantize
```

## Using uv

### Installing uv
If you don't have uv installed you can run the following:  
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

### MyPi install
```shell
uv tool install parllama
```

To upgrade an existing uv installation use the -U --force flags:
```bash
uv tool install parllama -U --force
```

### Installing / running using uvx
```shell
uvx parllama
```

### Source install from GitHub
```bash
uv tool install git+https://github.com/paulrobello/parllama
```
To upgrade an existing installation use the --force flag:
```bash
uv tool install git+https://github.com/paulrobello/parllama -U --force
```

## pipx
### Installing
If you don't have pipx installed you can run the following:  
```bash
pip install pipx
pipx ensurepath
```

### MyPi install
```shell
pipx install parllama
```

To upgrade an existing pipx installation use the --force flag:
```bash
pipx install parllama --force
```

### Source install from GitHub
```bash
pipx install git+https://github.com/paulrobello/parllama
```

To upgrade an existing installation use the --force flag:
```bash
pipx install git+https://github.com/paulrobello/parllama --force
```


## Installing for dev mode
Clone the repo and run the setup make target. Note `uv` is required for this.
```bash
git clone https://github.com/paulrobello/parllama
cd parllama
make setup
```


## Command line arguments
```
usage: parllama [-h] [-v] [-d DATA_DIR] [-u OLLAMA_URL] [-t THEME_NAME] [-m {dark,light}]
                [-s {local,site,chat,prompts,tools,create,options,logs}] [--use-last-tab-on-startup {0,1}] [-p PS_POLL] [-a {0,1}]
                [--restore-defaults] [--purge-cache] [--purge-chats] [--purge-prompts] [--no-save] [--no-chat-save]

PAR LLAMA -- Ollama TUI.

options:
  -h, --help            show this help message and exit
  -v, --version         Show version information.
  -d DATA_DIR, --data-dir DATA_DIR
                        Data Directory. Defaults to ~/.parllama
  -u OLLAMA_URL, --ollama-url OLLAMA_URL
                        URL of your Ollama instance. Defaults to http://localhost:11434
  -t THEME_NAME, --theme-name THEME_NAME
                        Theme name. Defaults to par
  -m {dark,light}, --theme-mode {dark,light}
                        Dark / Light mode. Defaults to dark
  -s {local,site,chat,prompts,tools,create,options,logs}, --starting-tab {local,site,chat,prompts,tools,create,options,logs}
                        Starting tab. Defaults to local
  --use-last-tab-on-startup {0,1}
                        Use last tab on startup. Defaults to 1
  -p PS_POLL, --ps-poll PS_POLL
                        Interval in seconds to poll ollama ps command. 0 = disable. Defaults to 3
  -a {0,1}, --auto-name-session {0,1}
                        Auto name session using LLM. Defaults to 0
  --restore-defaults    Restore default settings and theme
  --purge-cache         Purge cached data
  --purge-chats         Purge all chat history
  --purge-prompts       Purge all custom prompts
  --no-save             Prevent saving settings for this session
  --no-chat-save        Prevent saving chats for this session
```

Unless you specify "--no-save" most flags such as -u, -t, -m, -s are sticky and will be used next time you start PAR_LLAMA.

## Environment Variables
### Variables are loaded in the following order, last one to set a var wins
* PARLLAMA_DATA_DIR/.env
* HOST Environment
* ParLlama Options Screen

### Environment Variables for PAR LLAMA configuration
* PARLLAMA_DATA_DIR - Used to set --data-dir
* PARLLAMA_THEME_NAME - Used to set --theme-name
* PARLLAMA_THEME_MODE - Used to set --theme-mode
* OLLAMA_URL - Used to set --ollama-url
* PARLLAMA_AUTO_NAME_SESSION - Set to 0 or 1 to disable / enable session auto naming using LLM

## Running PAR_LLAMA

### with pipx or uv tool installation
From anywhere:
```bash
parllama
```

### with pip installation
From parent folder of venv
```bash
source venv/Scripts/activate
parllama
```
## Running against a remote Ollama instance
```bash
parllama -u "http://REMOTE_HOST:11434"
```

## Running under Windows WSL
Ollama by default only listens to localhost for connections, so you must set the environment variable OLLAMA_HOST=0.0.0.0:11434
to make it listen on all interfaces.  
**Note: this will allow connections to your Ollama server from other devices on any network you are connected to.**  
If you have Ollama installed via the native Windows installer you must set OLLAMA_HOST=0.0.0.0:11434 in the "System Variable" section
of the "Environment Variables" control panel.  
If you installed Ollama under WSL, setting the var with ```export OLLAMA_HOST=0.0.0.0:11434``` before starting the Ollama server will have it listen on all interfaces.
If your Ollama server is already running, stop and start it to ensure it picks up the new environment variable.  
You can validate what interfaces the Ollama server is listening on by looking at the server.log file in the Ollama config folder.  
You should see as one of the first few lines "OLLAMA_HOST:http://0.0.0.0:11434"  

Now that the server is listening on all interfaces you must instruct PAR_LLAMA to use a custom Ollama connection url with the "-u" flag.  
The command will look something like this:  
```bash
parllama -u "http://$(hostname).local:11434"
```
Depending on your DNS setup if the above does not work, try this:  
```bash
parllama -u "http://$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):11434"
```

PAR_LLAMA will remember the -u flag so subsequent runs will not require that you specify it.

### Dev mode
From repo root:
```bash
make dev
```

## Quick start chat workflow
* Start parllama.
* Click the "Site" tab.
* Use ^R to fetch the latest models from Ollama.com.
* Use the "Filter Site models" text box and type "llama3".
* Find the entry with title of "llama3".
* Click the blue tag "8B" to update the search box to read "llama3:8b".
* Press ^P to pull the model from Ollama to your local machine. Depending on the size of the model and your internet connection this can take a few min.
* Click the "Local" tab to see models that have been locally downloaded.
* Select the "llama3:8b" entry and press ^C to jump to the "Chat" tab and auto select the model.
* Type a message to the model such as "Why is the sky blue?". It will take a few seconds for Ollama to load the model. After which the LLMs answer will stream in.
* Towards the very top of the app you will see what model is loaded and what percent of it is loaded into the GPU / CPU. If a model cant be loaded 100% on the GPU it will run slower.
* To export your conversation as a Markdown file type "/session.export" in the message input box. This will open a export dialog.
* Press ^N to add a new chat tab.
* Select a different model or change the temperature and ask the same questions.
* Jump between the tabs to compare responses by click the tabs or using slash commands `/tab.1` and `/tab.2`
* Press ^S to see all your past and current sessions. You can recall any past session by selecting it and pressing Enter or ^N if you want to load it into a new tab.
* Press ^P to see / change your sessions config options such as provider, model, temperature, etc.
* Type "/help" or "/?" to see what other slash commands are available.

## Quick start image chat workflow
* Start parllama.
* Click the "Site" tab.
* Use ^R to fetch the latest models from Ollama.com.
* Use the "Filter Site models" text box and type "llava-llama3".
* Find the entry with title of "llava-llama3".
* Click the blue tag "8B" to update the search box to read "llava-llama3:8b".
* Press ^P to pull the model from Ollama to your local machine. Depending on the size of the model and your internet connection this can take a few min.
* Click the "Local" tab to see models that have been locally downloaded. If the download is complete and it isn't showing up here you may need to refresh the list with ^R.
* Select the "llava-llama3" entry and press ^C to jump to the "Chat" tab and auto select the model.
* Use a slash command to add an image and a prompt "/add.image PATH_TO_IMAGE describe whats happening in this image". It will take a few seconds for Ollama to load the model. After which the LLMs answer will stream in.
* Towards the very top of the app you will see what model is loaded and what percent of it is loaded into the GPU / CPU. If a model cant be loaded 100% on the GPU it will run slower.
* Type "/help" or "/?" to see what other slash commands are available.


## Custom Prompts
You can create a library of custom prompts for easy starting of new chats.  
You can set up system prompts and user messages to prime conversations with the option of sending immediately to the LLM upon loading of the prompt.  
Currently, importing prompts from the popular Fabric project is supported with more on the way.  


## Themes
Themes are json files stored in the themes folder in the data directory which defaults to **~/.parllama/themes**  

The default theme is "par" so can be located in **~/.parllama/themes/par.json**  

Themes have a dark and light mode are in the following format:  
```json
{
  "dark": {
    "primary": "#e49500",
    "secondary": "#6e4800",
    "warning": "#ffa62b",
    "error": "#ba3c5b",
    "success": "#4EBF71",
    "accent": "#6e4800",
    "panel": "#111",
    "surface":"#1e1e1e",
    "background":"#121212",
    "dark": true
  },
  "light": {
    "primary": "#004578",
    "secondary": "#ffa62b",
    "warning": "#ffa62b",
    "error": "#ba3c5b",
    "success": "#4EBF71",
    "accent": "#0178D4",
    "background":"#efefef",
    "surface":"#f5f5f5",
    "dark": false
  }
}
```

You must specify at least one of light or dark for the theme to be usable.  

Theme can be changed via command line with the ```--theme-name``` option.

## Contributing
Start by following the instructions in the section **Installing for dev mode**.  

Please ensure that all pull requests are formatted with black, pass mypy and pylint with 10/10 checks.  
You can run the make target **pre-commit** to ensure the pipeline will pass with your changes.  
There is also a pre-commit config to that will assist with formatting and checks.  
The easiest way to setup your environment to ensure smooth pull requests is:  

With uv installed:
```bash
uv tool install pre-commit
```

With pipx installed:
```bash
pipx install pre-commit
```

From repo root run the following:
```bash
pre-commit install
pre-commit run --all-files
```
After running the above all future commits will auto run pre-commit. pre-commit will fix what it can and show what
if anything remains to be fixed before the commit is allowed.

## FAQ
* Q: Do I need Docker?
  * A: Docker is only required if you want to Quantize models downloaded from Huggingface or similar llm repositories.
* Q: Does ParLlama require internet access?
  * A: ParLlama by default does not require any network / internet access unless you enable checking for updates or want to import / use data from an online source.
* Q: Does ParLlama run on ARM?
  * A: Short answer is yes. ParLlama should run any place python does. It has been tested on Windows 11 x64, Windows WSL x64, Mac OSX intel and silicon
* Q: Does Parllama require Ollama be installed locally?
  * A: No. ParLlama has options to connect to remote Ollama instances

## Roadmap

### Where we are
* Initial release - Find, maintain and create new models
* Connect to remote instances
* Chat with history / conversation management
* Chat tabs allow chat with multiple models at same time
* Custom prompt library with import from Fabric
* Auto complete of slash commands, input history, multi line edit
* Ability to use cloud AI providers like OpenAI, Anthropic, Groq, and Google
* Use images with vision capable LLMs

### Where we're going

* RAG for local documents and web pages
* Expand ability to import custom prompts of other tools
* LLM tool use


## What's new

### v0.3.10
* Fixed crash issues on fresh installs
* Images are now stored in chat session json files
* Added API key checks for online providers

### v0.3.9
* Image support for models that support them using /add.image slash command. See the [Quick start image chat workflow](#quick-start-image-chat-workflow)
* Add history support for both single and multi line input modes
* Fixed crash on models that dont have a license
* Fixed last model used not get used with new sessions

### v0.3.8
* Major rework of core to support providers other than Ollama
* Added support for the following online providers: OpenAI, Anthropic, Groq, Google
* New session config panel docked to right side of chat tab (more settings coming soon)
* Better counting of tokens (still not always 100% accurate)

### v0.3.7
* Fix for possible crash when there is more than one model loaded into ollama

### v0.3.6
* Added option to save chat input history and set its length
* Fixed tab switch issue on startup
* Added cache for Fabric import to speed up subsequent imports

### v0.3.5
* Added first time launch welcome
* Added Options tab which exposes more options than are available via command line switches
* Added option to auto check for new versions
* Added ability to import custom prompts from [fabric](https://github.com/danielmiessler/fabric)
* Added toggle between single and multi line input (Note auto complete and command history features not available in multi line edit mode)

### v0.3.4
* Added custom prompt library support  (Work in progress)
* Added cli option and environment var to enable auto naming of sessions using LLM (Work in progress)
* Added tokens per second stats to session info line on chat tab
* Fixed app crash when it cant contact ollama server for PS info
* Fixed slow startup when you have a lot of models available locally
* Fixed slow startup and reduced memory utilization when you have many / large chats
* Fixed session unique naming bug where it would always add a "1" to the session name
* Fixed app sometimes slowing down during LLM generation
* Major rework of internal message handling
* Issue where some footer items are not clickable has been resolved by a library PARLLAMA depends on

### v0.3.3
* Added ability to edit existing messages. select message in chat list and press "e" to edit, then "escape" to exit edit mode
* Add chat input history access via up / down arrow while chat message input has focus
* Added /session.system_prompt command to set system prompt in current chat tab

### v0.3.2
* Ollama ps stats bar now works with remote connections except for CPU / GPU %'s which ollama's api does not provide
* Chat tabs now have a session info bar with info like current / max context length
* Added conversation stop button to abort llm response
* Added ability to delete messages from session
* More model details displayed on model detail screen
* Better performance when changing session params on chat tab

### v0.3.1
* Add chat tabs to support multiple sessions
* Added cli option to prevent saving chat history to disk
* Renamed / namespaced chat slash commands for better consistency and grouping
* Fixed application crash when ollama binary not found

### v0.3.0
* Added chat history panel and management to chat page

### v0.2.51
* Fix missing dependency in package

### v0.2.5
* Added slash commands to chat input
* Added ability to export chat to markdown file
* ctrl+c on local model list will jump to chat tab and select currently selected local model
* ctrl+c on chat tab will copy selected chat message

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "parllama",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Paul Robello <probello@gmail.com>",
    "keywords": "ai, ollama, terminal, tui",
    "author": null,
    "author_email": "Paul Robello <probello@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/dd/ed/378af476cf94c3185c50f87acc9c7e99d9f8c416ea1734245acea4d8115d/parllama-0.3.10.tar.gz",
    "platform": null,
    "description": "# PAR LLAMA\n\n## Table of Contents\n\n* [About](#about)\n   * [Screenshots](#screenshots)\n* [Prerequisites for running](#prerequisites-for-running)\n* [Prerequisites for dev](#prerequisites-for-dev)\n* [Prerequisites for huggingface model quantization](#prerequisites-for-huggingface-model-quantization)\n* [Installing using pipx](#installing-from-mypi-using-pipx)\n* [Installing from mypi using pip](#installing-from-mypi-using-pip)\n* [Installing for dev mode](#installing-for-dev-mode)\n* [Command line arguments](#command-line-arguments)\n* [Environment Variables](#environment-variables)\n* [Running PAR_LLAMA](#running-par_llama)\n    * [with pipx installation](#with-pipx-installation)\n    * [with pip installation](#with-pip-installation)\n* [Running against a remote instance](#running-against-a-remote-instance)\n* [Running under Windows WSL](#running-under-windows-wsl)\n    * [Dev mode](#dev-mode)\n* [Quick start chat workflow](#quick-start-chat-workflow)\n* [Custom Prompts](#Custom-Prompts)\n* [Themes](#themes)\n* [Screen Help](https://raw.githubusercontent.com/paulrobello/parllama/main/src/parllama/help.md)\n* [Contributing](#contributing)\n* [FAQ](#faq)\n* [Roadmap](#roadmap)\n    * [Where we are](#where-we-are)\n    * [Where we're going](#where-were-going)\n* [What's new](#whats-new)\n    * [v0.3.10](#v0310)\n    * [v0.3.9](#v039)\n    * [v0.3.8](#v038)\n    * [v0.3.7](#v037)\n    * [v0.3.6](#v036)\n    * [v0.3.5](#v035)\n    * [v0.3.4](#v034)\n    * [v0.3.3](#v033)\n    * [v0.3.2](#v032)\n    * [v0.3.1](#v031)\n    * [v0.3.0](#v030)\n    * [v0.2.51](#v0251)\n    * [v0.2.5](#v025)\n\n[![PyPI](https://img.shields.io/pypi/v/parllama)](https://pypi.org/project/parllama/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/parllama.svg)](https://pypi.org/project/parllama/)  \n![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)\n![Arch x86-63 | ARM | AppleSilicon](https://img.shields.io/badge/arch-x86--64%20%7C%20ARM%20%7C%20AppleSilicon-blue)  \n![PyPI - License](https://img.shields.io/pypi/l/parllama)\n\n## About\nPAR LLAMA is a TUI application designed for easy management and use of Ollama based LLMs.\nThe application was built with [Textual](https://textual.textualize.io/) and [Rich](https://github.com/Textualize/rich?tab=readme-ov-file)\nand runs on all major OS's including but not limited to Windows, Windows WSL, Mac, and Linux.\n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/probello3)\n\n## Screenshots\nSupports Dark and Light mode as well as custom themes.\n\n![Chat Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/chat_dark_1.png)\n\n![Chat Image Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/chat_image_dark_1.png)\n\n![Local Models Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/local_models_dark_1.png)\n\n![Model View Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/models_view_dark_1.png)\n\n![Site Models Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/site_models_dark_1.png)\n\n![Custom Prompt Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/custom_prompt_dark_1.png)\n\n![Options Dark](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/options_dark_1.png)\n\n![Local Models Light](https://raw.githubusercontent.com/paulrobello/parllama/main/docs/local_models_light_1.png)\n\n## Videos\n[V0.3.5 demo](https://www.youtube.com/watch?v=Genv46SKA5o)\n\n## Prerequisites for running\n* Install and run [Ollama](https://ollama.com/download)\n* Install Python 3.11 or newer\n  * [https://www.python.org/downloads/](https://www.python.org/downloads/) has installers for all versions of Python for all os's\n  * On Windows the [Scoop](https://scoop.sh/) tool makes it easy to install and manage things like python\n    * Install Scoop then do `scoop install python`\n\n## Prerequisites for dev\n* Install uv\n  * See the [Using uv](#Using-uv) section\n* Install GNU Compatible Make command\n  * On windows if you have scoop installed you can install make with `scoop install make`\n\n## Prerequisites for huggingface model quantization\nIf you want to be able to quantize custom models from huggingface, download the following tool from the releases area:\n[HuggingFaceModelDownloader](https://github.com/bodaay/HuggingFaceModelDownloader)\n\nInstall [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n\nPull the docker image ollama/quantize\n```bash\ndocker pull ollama/quantize\n```\n\n## Using uv\n\n### Installing uv\nIf you don't have uv installed you can run the following:  \n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n### MyPi install\n```shell\nuv tool install parllama\n```\n\nTo upgrade an existing uv installation use the -U --force flags:\n```bash\nuv tool install parllama -U --force\n```\n\n### Installing / running using uvx\n```shell\nuvx parllama\n```\n\n### Source install from GitHub\n```bash\nuv tool install git+https://github.com/paulrobello/parllama\n```\nTo upgrade an existing installation use the --force flag:\n```bash\nuv tool install git+https://github.com/paulrobello/parllama -U --force\n```\n\n## pipx\n### Installing\nIf you don't have pipx installed you can run the following:  \n```bash\npip install pipx\npipx ensurepath\n```\n\n### MyPi install\n```shell\npipx install parllama\n```\n\nTo upgrade an existing pipx installation use the --force flag:\n```bash\npipx install parllama --force\n```\n\n### Source install from GitHub\n```bash\npipx install git+https://github.com/paulrobello/parllama\n```\n\nTo upgrade an existing installation use the --force flag:\n```bash\npipx install git+https://github.com/paulrobello/parllama --force\n```\n\n\n## Installing for dev mode\nClone the repo and run the setup make target. Note `uv` is required for this.\n```bash\ngit clone https://github.com/paulrobello/parllama\ncd parllama\nmake setup\n```\n\n\n## Command line arguments\n```\nusage: parllama [-h] [-v] [-d DATA_DIR] [-u OLLAMA_URL] [-t THEME_NAME] [-m {dark,light}]\n                [-s {local,site,chat,prompts,tools,create,options,logs}] [--use-last-tab-on-startup {0,1}] [-p PS_POLL] [-a {0,1}]\n                [--restore-defaults] [--purge-cache] [--purge-chats] [--purge-prompts] [--no-save] [--no-chat-save]\n\nPAR LLAMA -- Ollama TUI.\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --version         Show version information.\n  -d DATA_DIR, --data-dir DATA_DIR\n                        Data Directory. Defaults to ~/.parllama\n  -u OLLAMA_URL, --ollama-url OLLAMA_URL\n                        URL of your Ollama instance. Defaults to http://localhost:11434\n  -t THEME_NAME, --theme-name THEME_NAME\n                        Theme name. Defaults to par\n  -m {dark,light}, --theme-mode {dark,light}\n                        Dark / Light mode. Defaults to dark\n  -s {local,site,chat,prompts,tools,create,options,logs}, --starting-tab {local,site,chat,prompts,tools,create,options,logs}\n                        Starting tab. Defaults to local\n  --use-last-tab-on-startup {0,1}\n                        Use last tab on startup. Defaults to 1\n  -p PS_POLL, --ps-poll PS_POLL\n                        Interval in seconds to poll ollama ps command. 0 = disable. Defaults to 3\n  -a {0,1}, --auto-name-session {0,1}\n                        Auto name session using LLM. Defaults to 0\n  --restore-defaults    Restore default settings and theme\n  --purge-cache         Purge cached data\n  --purge-chats         Purge all chat history\n  --purge-prompts       Purge all custom prompts\n  --no-save             Prevent saving settings for this session\n  --no-chat-save        Prevent saving chats for this session\n```\n\nUnless you specify \"--no-save\" most flags such as -u, -t, -m, -s are sticky and will be used next time you start PAR_LLAMA.\n\n## Environment Variables\n### Variables are loaded in the following order, last one to set a var wins\n* PARLLAMA_DATA_DIR/.env\n* HOST Environment\n* ParLlama Options Screen\n\n### Environment Variables for PAR LLAMA configuration\n* PARLLAMA_DATA_DIR - Used to set --data-dir\n* PARLLAMA_THEME_NAME - Used to set --theme-name\n* PARLLAMA_THEME_MODE - Used to set --theme-mode\n* OLLAMA_URL - Used to set --ollama-url\n* PARLLAMA_AUTO_NAME_SESSION - Set to 0 or 1 to disable / enable session auto naming using LLM\n\n## Running PAR_LLAMA\n\n### with pipx or uv tool installation\nFrom anywhere:\n```bash\nparllama\n```\n\n### with pip installation\nFrom parent folder of venv\n```bash\nsource venv/Scripts/activate\nparllama\n```\n## Running against a remote Ollama instance\n```bash\nparllama -u \"http://REMOTE_HOST:11434\"\n```\n\n## Running under Windows WSL\nOllama by default only listens to localhost for connections, so you must set the environment variable OLLAMA_HOST=0.0.0.0:11434\nto make it listen on all interfaces.  \n**Note: this will allow connections to your Ollama server from other devices on any network you are connected to.**  \nIf you have Ollama installed via the native Windows installer you must set OLLAMA_HOST=0.0.0.0:11434 in the \"System Variable\" section\nof the \"Environment Variables\" control panel.  \nIf you installed Ollama under WSL, setting the var with ```export OLLAMA_HOST=0.0.0.0:11434``` before starting the Ollama server will have it listen on all interfaces.\nIf your Ollama server is already running, stop and start it to ensure it picks up the new environment variable.  \nYou can validate what interfaces the Ollama server is listening on by looking at the server.log file in the Ollama config folder.  \nYou should see as one of the first few lines \"OLLAMA_HOST:http://0.0.0.0:11434\"  \n\nNow that the server is listening on all interfaces you must instruct PAR_LLAMA to use a custom Ollama connection url with the \"-u\" flag.  \nThe command will look something like this:  \n```bash\nparllama -u \"http://$(hostname).local:11434\"\n```\nDepending on your DNS setup if the above does not work, try this:  \n```bash\nparllama -u \"http://$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):11434\"\n```\n\nPAR_LLAMA will remember the -u flag so subsequent runs will not require that you specify it.\n\n### Dev mode\nFrom repo root:\n```bash\nmake dev\n```\n\n## Quick start chat workflow\n* Start parllama.\n* Click the \"Site\" tab.\n* Use ^R to fetch the latest models from Ollama.com.\n* Use the \"Filter Site models\" text box and type \"llama3\".\n* Find the entry with title of \"llama3\".\n* Click the blue tag \"8B\" to update the search box to read \"llama3:8b\".\n* Press ^P to pull the model from Ollama to your local machine. Depending on the size of the model and your internet connection this can take a few min.\n* Click the \"Local\" tab to see models that have been locally downloaded.\n* Select the \"llama3:8b\" entry and press ^C to jump to the \"Chat\" tab and auto select the model.\n* Type a message to the model such as \"Why is the sky blue?\". It will take a few seconds for Ollama to load the model. After which the LLMs answer will stream in.\n* Towards the very top of the app you will see what model is loaded and what percent of it is loaded into the GPU / CPU. If a model cant be loaded 100% on the GPU it will run slower.\n* To export your conversation as a Markdown file type \"/session.export\" in the message input box. This will open a export dialog.\n* Press ^N to add a new chat tab.\n* Select a different model or change the temperature and ask the same questions.\n* Jump between the tabs to compare responses by click the tabs or using slash commands `/tab.1` and `/tab.2`\n* Press ^S to see all your past and current sessions. You can recall any past session by selecting it and pressing Enter or ^N if you want to load it into a new tab.\n* Press ^P to see / change your sessions config options such as provider, model, temperature, etc.\n* Type \"/help\" or \"/?\" to see what other slash commands are available.\n\n## Quick start image chat workflow\n* Start parllama.\n* Click the \"Site\" tab.\n* Use ^R to fetch the latest models from Ollama.com.\n* Use the \"Filter Site models\" text box and type \"llava-llama3\".\n* Find the entry with title of \"llava-llama3\".\n* Click the blue tag \"8B\" to update the search box to read \"llava-llama3:8b\".\n* Press ^P to pull the model from Ollama to your local machine. Depending on the size of the model and your internet connection this can take a few min.\n* Click the \"Local\" tab to see models that have been locally downloaded. If the download is complete and it isn't showing up here you may need to refresh the list with ^R.\n* Select the \"llava-llama3\" entry and press ^C to jump to the \"Chat\" tab and auto select the model.\n* Use a slash command to add an image and a prompt \"/add.image PATH_TO_IMAGE describe whats happening in this image\". It will take a few seconds for Ollama to load the model. After which the LLMs answer will stream in.\n* Towards the very top of the app you will see what model is loaded and what percent of it is loaded into the GPU / CPU. If a model cant be loaded 100% on the GPU it will run slower.\n* Type \"/help\" or \"/?\" to see what other slash commands are available.\n\n\n## Custom Prompts\nYou can create a library of custom prompts for easy starting of new chats.  \nYou can set up system prompts and user messages to prime conversations with the option of sending immediately to the LLM upon loading of the prompt.  \nCurrently, importing prompts from the popular Fabric project is supported with more on the way.  \n\n\n## Themes\nThemes are json files stored in the themes folder in the data directory which defaults to **~/.parllama/themes**  \n\nThe default theme is \"par\" so can be located in **~/.parllama/themes/par.json**  \n\nThemes have a dark and light mode are in the following format:  \n```json\n{\n  \"dark\": {\n    \"primary\": \"#e49500\",\n    \"secondary\": \"#6e4800\",\n    \"warning\": \"#ffa62b\",\n    \"error\": \"#ba3c5b\",\n    \"success\": \"#4EBF71\",\n    \"accent\": \"#6e4800\",\n    \"panel\": \"#111\",\n    \"surface\":\"#1e1e1e\",\n    \"background\":\"#121212\",\n    \"dark\": true\n  },\n  \"light\": {\n    \"primary\": \"#004578\",\n    \"secondary\": \"#ffa62b\",\n    \"warning\": \"#ffa62b\",\n    \"error\": \"#ba3c5b\",\n    \"success\": \"#4EBF71\",\n    \"accent\": \"#0178D4\",\n    \"background\":\"#efefef\",\n    \"surface\":\"#f5f5f5\",\n    \"dark\": false\n  }\n}\n```\n\nYou must specify at least one of light or dark for the theme to be usable.  \n\nTheme can be changed via command line with the ```--theme-name``` option.\n\n## Contributing\nStart by following the instructions in the section **Installing for dev mode**.  \n\nPlease ensure that all pull requests are formatted with black, pass mypy and pylint with 10/10 checks.  \nYou can run the make target **pre-commit** to ensure the pipeline will pass with your changes.  \nThere is also a pre-commit config to that will assist with formatting and checks.  \nThe easiest way to setup your environment to ensure smooth pull requests is:  \n\nWith uv installed:\n```bash\nuv tool install pre-commit\n```\n\nWith pipx installed:\n```bash\npipx install pre-commit\n```\n\nFrom repo root run the following:\n```bash\npre-commit install\npre-commit run --all-files\n```\nAfter running the above all future commits will auto run pre-commit. pre-commit will fix what it can and show what\nif anything remains to be fixed before the commit is allowed.\n\n## FAQ\n* Q: Do I need Docker?\n  * A: Docker is only required if you want to Quantize models downloaded from Huggingface or similar llm repositories.\n* Q: Does ParLlama require internet access?\n  * A: ParLlama by default does not require any network / internet access unless you enable checking for updates or want to import / use data from an online source.\n* Q: Does ParLlama run on ARM?\n  * A: Short answer is yes. ParLlama should run any place python does. It has been tested on Windows 11 x64, Windows WSL x64, Mac OSX intel and silicon\n* Q: Does Parllama require Ollama be installed locally?\n  * A: No. ParLlama has options to connect to remote Ollama instances\n\n## Roadmap\n\n### Where we are\n* Initial release - Find, maintain and create new models\n* Connect to remote instances\n* Chat with history / conversation management\n* Chat tabs allow chat with multiple models at same time\n* Custom prompt library with import from Fabric\n* Auto complete of slash commands, input history, multi line edit\n* Ability to use cloud AI providers like OpenAI, Anthropic, Groq, and Google\n* Use images with vision capable LLMs\n\n### Where we're going\n\n* RAG for local documents and web pages\n* Expand ability to import custom prompts of other tools\n* LLM tool use\n\n\n## What's new\n\n### v0.3.10\n* Fixed crash issues on fresh installs\n* Images are now stored in chat session json files\n* Added API key checks for online providers\n\n### v0.3.9\n* Image support for models that support them using /add.image slash command. See the [Quick start image chat workflow](#quick-start-image-chat-workflow)\n* Add history support for both single and multi line input modes\n* Fixed crash on models that dont have a license\n* Fixed last model used not get used with new sessions\n\n### v0.3.8\n* Major rework of core to support providers other than Ollama\n* Added support for the following online providers: OpenAI, Anthropic, Groq, Google\n* New session config panel docked to right side of chat tab (more settings coming soon)\n* Better counting of tokens (still not always 100% accurate)\n\n### v0.3.7\n* Fix for possible crash when there is more than one model loaded into ollama\n\n### v0.3.6\n* Added option to save chat input history and set its length\n* Fixed tab switch issue on startup\n* Added cache for Fabric import to speed up subsequent imports\n\n### v0.3.5\n* Added first time launch welcome\n* Added Options tab which exposes more options than are available via command line switches\n* Added option to auto check for new versions\n* Added ability to import custom prompts from [fabric](https://github.com/danielmiessler/fabric)\n* Added toggle between single and multi line input (Note auto complete and command history features not available in multi line edit mode)\n\n### v0.3.4\n* Added custom prompt library support  (Work in progress)\n* Added cli option and environment var to enable auto naming of sessions using LLM (Work in progress)\n* Added tokens per second stats to session info line on chat tab\n* Fixed app crash when it cant contact ollama server for PS info\n* Fixed slow startup when you have a lot of models available locally\n* Fixed slow startup and reduced memory utilization when you have many / large chats\n* Fixed session unique naming bug where it would always add a \"1\" to the session name\n* Fixed app sometimes slowing down during LLM generation\n* Major rework of internal message handling\n* Issue where some footer items are not clickable has been resolved by a library PARLLAMA depends on\n\n### v0.3.3\n* Added ability to edit existing messages. select message in chat list and press \"e\" to edit, then \"escape\" to exit edit mode\n* Add chat input history access via up / down arrow while chat message input has focus\n* Added /session.system_prompt command to set system prompt in current chat tab\n\n### v0.3.2\n* Ollama ps stats bar now works with remote connections except for CPU / GPU %'s which ollama's api does not provide\n* Chat tabs now have a session info bar with info like current / max context length\n* Added conversation stop button to abort llm response\n* Added ability to delete messages from session\n* More model details displayed on model detail screen\n* Better performance when changing session params on chat tab\n\n### v0.3.1\n* Add chat tabs to support multiple sessions\n* Added cli option to prevent saving chat history to disk\n* Renamed / namespaced chat slash commands for better consistency and grouping\n* Fixed application crash when ollama binary not found\n\n### v0.3.0\n* Added chat history panel and management to chat page\n\n### v0.2.51\n* Fix missing dependency in package\n\n### v0.2.5\n* Added slash commands to chat input\n* Added ability to export chat to markdown file\n* ctrl+c on local model list will jump to chat tab and select currently selected local model\n* ctrl+c on chat tab will copy selected chat message\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Paul Robello  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Terminal UI for Ollama",
    "version": "0.3.10",
    "project_urls": {
        "Discussions": "https://github.com/paulrobello/parllama/discussions",
        "Documentation": "https://github.com/paulrobello/parllama/blob/main/README.md",
        "Homepage": "https://github.com/paulrobello/parllama",
        "Issues": "https://github.com/paulrobello/parllama/issues",
        "Source": "https://github.com/paulrobello/parllama",
        "Wiki": "https://github.com/paulrobello/parllama/wiki"
    },
    "split_keywords": [
        "ai",
        " ollama",
        " terminal",
        " tui"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "764fbaf430c985531ad3df0aef40b10d72455037ca86d4753633e501c650325c",
                "md5": "2aef82f7f313c5c92f2f6495a6208639",
                "sha256": "bdefc1801e6a05b7c1694987c556393dfe75a244e5ccd3ce6b253ef0d5241410"
            },
            "downloads": -1,
            "filename": "parllama-0.3.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2aef82f7f313c5c92f2f6495a6208639",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 162298,
            "upload_time": "2024-09-25T05:29:03",
            "upload_time_iso_8601": "2024-09-25T05:29:03.224266Z",
            "url": "https://files.pythonhosted.org/packages/76/4f/baf430c985531ad3df0aef40b10d72455037ca86d4753633e501c650325c/parllama-0.3.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dded378af476cf94c3185c50f87acc9c7e99d9f8c416ea1734245acea4d8115d",
                "md5": "e17043a2d938e3ef18e8743ce80e8645",
                "sha256": "d479f6baafaecdfa8b90d12f289d0cfae10f6118f9a13f090f890d3f9bb114b0"
            },
            "downloads": -1,
            "filename": "parllama-0.3.10.tar.gz",
            "has_sig": false,
            "md5_digest": "e17043a2d938e3ef18e8743ce80e8645",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 111218,
            "upload_time": "2024-09-25T05:29:05",
            "upload_time_iso_8601": "2024-09-25T05:29:05.378646Z",
            "url": "https://files.pythonhosted.org/packages/dd/ed/378af476cf94c3185c50f87acc9c7e99d9f8c416ea1734245acea4d8115d/parllama-0.3.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-25 05:29:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paulrobello",
    "github_project": "parllama",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "parllama"
}
        
Elapsed time: 0.40133s