# Charla: Chat with Language Models in a Terminal
[![PyPI - Version](https://img.shields.io/pypi/v/charla.svg)](https://pypi.org/project/charla)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/charla.svg)](https://pypi.org/project/charla)
**Charla** is a terminal based application for chatting with language models. Charla integrates with Ollama and GitHub Models for exchanging messages with model services.
![preview](https://geeksta.net/img/tools/charla-chat-demo.gif)
## Features
* Terminal-based chat system that supports context aware conversations with language models.
* Support for local models via Ollama and remote models via GitHub Models.
* Chat sessions are saved as markdown files in the user's documents directory when ending a chat.
* Prompt history is saved and previously entered prompts are auto-suggested.
* Switch between single-line and multi-line input modes without interrupting the chat session.
* Store default user preferences in a settings file.
* Provide a system prompt for a chat session.
* Load content from local files and web pages to append to prompts.
## Installation
To use Charla with models on your computer, you need a running installation of the [Ollama server](https://ollama.com/download) and at least one supported language model must be installed. For [GitHub Models](https://github.com/marketplace/models) you need access to the service and a GitHub token. Please refer to the documentation of the service provider you want to use for installation and setup instructions.
Install Charla using `pipx`:
```console
pipx install charla
```
For GitHub models, set the environment variable GITHUB_TOKEN to your token. In Bash enter:
```console
export GITHUB_TOKEN=YOUR_GITHUB_TOKEN
```
## Usage
After successful installation and setup you can launch the chat console with the `charla` command in your terminal.
If you use Charla with Ollama, the default provider, you only need to specify the model to use, e.g.:
```console
charla -m phi3
```
If you want to use GitHub Models, you have to set the provider:
```console
charla -m gpt-4o --provider github
```
You can set a default model and change the default provider in your user settings file.
## Settings
Settings can be specified as command line arguments and in the settings file. Command line arguments have the highest priority. The location of your settings file depends on your operating system. Use the following command to show the location:
```console
charla settings --location
```
Example settings for using OpenAI's GPT-4o model and the GitHub Models service by default.
```json
{
"model": "gpt-4o",
"chats_path": "./chats",
"prompt_history": "./prompt-history.txt",
"provider": "github",
"message_limit": 20,
"multiline": false
}
```
## CLI Help
Output of `charla -h` with information on all available command line options.
<!-- START: DO NOT EDIT -->
```text
usage: charla [-h] [--model MODEL] [--chats-path CHATS_PATH] [--prompt-history PROMPT_HISTORY]
[--provider PROVIDER] [--message-limit MESSAGE_LIMIT] [--multiline] [--system-prompt SYSTEM_PROMPT]
[--version]
{settings} ...
Chat with language models.
positional arguments:
{settings} Sub Commands
settings Show current settings.
options:
-h, --help show this help message and exit
--model MODEL, -m MODEL
Name of language model to chat with.
--chats-path CHATS_PATH
Directory to store chats.
--prompt-history PROMPT_HISTORY
File to store prompt history.
--provider PROVIDER Name of the provider to use.
--message-limit MESSAGE_LIMIT
Maximum number of messages to send to GitHub Models service.
--multiline Use multiline mode.
--system-prompt SYSTEM_PROMPT, -sp SYSTEM_PROMPT
File that contains system prompt to use.
--version show program's version number and exit
```
<!-- END: DO NOT EDIT -->
## Development
Run the command-line interface directly from the project source without installing the package:
```console
python -m charla.cli
```
### ollama API
Installed models:
```console
curl http://localhost:11434/api/tags
```
Model info:
```console
curl http://localhost:11434/api/show -d '{"name": "phi3"}'
```
## License
Charla is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "charla",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "chat-client, chatbot, cli, github models, llm, ollama, terminal",
"author": null,
"author_email": "Ramiro G\u00f3mez <code@ramiro.org>",
"download_url": "https://files.pythonhosted.org/packages/31/59/c212c94ce6c7ca6ddc2141f20d74bbfd79c4fa1bf9a708bd693d8af5f145/charla-2.0.0.tar.gz",
"platform": null,
"description": "# Charla: Chat with Language Models in a Terminal\n\n[![PyPI - Version](https://img.shields.io/pypi/v/charla.svg)](https://pypi.org/project/charla)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/charla.svg)](https://pypi.org/project/charla)\n\n**Charla** is a terminal based application for chatting with language models. Charla integrates with Ollama and GitHub Models for exchanging messages with model services.\n\n![preview](https://geeksta.net/img/tools/charla-chat-demo.gif)\n\n## Features\n\n* Terminal-based chat system that supports context aware conversations with language models.\n* Support for local models via Ollama and remote models via GitHub Models.\n* Chat sessions are saved as markdown files in the user's documents directory when ending a chat.\n* Prompt history is saved and previously entered prompts are auto-suggested.\n* Switch between single-line and multi-line input modes without interrupting the chat session.\n* Store default user preferences in a settings file.\n* Provide a system prompt for a chat session.\n* Load content from local files and web pages to append to prompts.\n\n## Installation\n\nTo use Charla with models on your computer, you need a running installation of the [Ollama server](https://ollama.com/download) and at least one supported language model must be installed. For [GitHub Models](https://github.com/marketplace/models) you need access to the service and a GitHub token. Please refer to the documentation of the service provider you want to use for installation and setup instructions.\n\nInstall Charla using `pipx`:\n\n```console\npipx install charla\n```\n\nFor GitHub models, set the environment variable GITHUB_TOKEN to your token. In Bash enter:\n\n```console\nexport GITHUB_TOKEN=YOUR_GITHUB_TOKEN\n```\n\n## Usage\n\nAfter successful installation and setup you can launch the chat console with the `charla` command in your terminal.\n\nIf you use Charla with Ollama, the default provider, you only need to specify the model to use, e.g.:\n\n```console\ncharla -m phi3\n```\n\nIf you want to use GitHub Models, you have to set the provider:\n\n```console\ncharla -m gpt-4o --provider github\n```\n\nYou can set a default model and change the default provider in your user settings file.\n\n## Settings\n\nSettings can be specified as command line arguments and in the settings file. Command line arguments have the highest priority. The location of your settings file depends on your operating system. Use the following command to show the location:\n\n```console\ncharla settings --location\n```\n\nExample settings for using OpenAI's GPT-4o model and the GitHub Models service by default.\n\n```json\n{\n \"model\": \"gpt-4o\",\n \"chats_path\": \"./chats\",\n \"prompt_history\": \"./prompt-history.txt\",\n \"provider\": \"github\",\n \"message_limit\": 20,\n \"multiline\": false\n}\n```\n\n## CLI Help\n\nOutput of `charla -h` with information on all available command line options.\n\n<!-- START: DO NOT EDIT -->\n```text\nusage: charla [-h] [--model MODEL] [--chats-path CHATS_PATH] [--prompt-history PROMPT_HISTORY]\n [--provider PROVIDER] [--message-limit MESSAGE_LIMIT] [--multiline] [--system-prompt SYSTEM_PROMPT]\n [--version]\n {settings} ...\n\nChat with language models.\n\npositional arguments:\n {settings} Sub Commands\n settings Show current settings.\n\noptions:\n -h, --help show this help message and exit\n --model MODEL, -m MODEL\n Name of language model to chat with.\n --chats-path CHATS_PATH\n Directory to store chats.\n --prompt-history PROMPT_HISTORY\n File to store prompt history.\n --provider PROVIDER Name of the provider to use.\n --message-limit MESSAGE_LIMIT\n Maximum number of messages to send to GitHub Models service.\n --multiline Use multiline mode.\n --system-prompt SYSTEM_PROMPT, -sp SYSTEM_PROMPT\n File that contains system prompt to use.\n --version show program's version number and exit\n\n```\n<!-- END: DO NOT EDIT -->\n\n## Development\n\nRun the command-line interface directly from the project source without installing the package:\n\n```console\npython -m charla.cli\n```\n\n### ollama API\n\nInstalled models:\n\n```console\ncurl http://localhost:11434/api/tags\n```\n\nModel info:\n\n```console\ncurl http://localhost:11434/api/show -d '{\"name\": \"phi3\"}'\n```\n\n## License\n\nCharla is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": "A terminal based chat application that works with language models.",
"version": "2.0.0",
"project_urls": {
"Documentation": "https://github.com/yaph/charla#readme",
"Issues": "https://github.com/yaph/charla/issues",
"Source": "https://github.com/yaph/charla"
},
"split_keywords": [
"chat-client",
" chatbot",
" cli",
" github models",
" llm",
" ollama",
" terminal"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f31946555eddefb034959638029ff0daa3974b171df672f0d903adba5fbe9e47",
"md5": "d44fb9b8c3bd3054d7aa2b78cf067c51",
"sha256": "a7d06ca60105ed2dedc9fd329bb416bc17ba83ed22241266d935373c0bf3927c"
},
"downloads": -1,
"filename": "charla-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d44fb9b8c3bd3054d7aa2b78cf067c51",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10890,
"upload_time": "2024-10-16T21:35:15",
"upload_time_iso_8601": "2024-10-16T21:35:15.326435Z",
"url": "https://files.pythonhosted.org/packages/f3/19/46555eddefb034959638029ff0daa3974b171df672f0d903adba5fbe9e47/charla-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3159c212c94ce6c7ca6ddc2141f20d74bbfd79c4fa1bf9a708bd693d8af5f145",
"md5": "6f641abe39f003c2396e95fb95786802",
"sha256": "da5a3565c1881bf1e64bc715b431d0f8d6c69e8a65b50ee32f212dfd2c77e0c3"
},
"downloads": -1,
"filename": "charla-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "6f641abe39f003c2396e95fb95786802",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 13543,
"upload_time": "2024-10-16T21:35:16",
"upload_time_iso_8601": "2024-10-16T21:35:16.843682Z",
"url": "https://files.pythonhosted.org/packages/31/59/c212c94ce6c7ca6ddc2141f20d74bbfd79c4fa1bf9a708bd693d8af5f145/charla-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-16 21:35:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yaph",
"github_project": "charla#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "charla"
}