Skip to main content

Term-Assistant

Term Assistant is a command-line tool designed to assist users with prompt-based responses from various models. It supports customizable contexts, different models and providers, and options for managing input and output behaviors.

Installation

To install Term Assistant, you can use pip to install.

$ pip install term-assistant

Or you can install the whl file in releases.

Also, you can install the package from the source code, see the Contributing section.

Usage

The tool must run in tmux context ($TMUX environemnt variable must be set) since it uses tmux to capture the terminal history.

Config

You can copy the assistant.yaml.example to your home directory and rename it to assistant.yaml.

You can fill your API keys to the providers section, for example

...
providers:
  openai:
    base_url: ''
    api_key: 'sk-abc123456'

After filling the key, you can use all openai models.

More Providers

Term Assistant uses litellm as the SDK, so you can use any provider and model that litellm supports.

The full list of providers and models can be found in the litellm documentation.

To use a provider, you need to fill the api_key in providers section in the config file (even if the key is not required for that provider, e.g., ollama).

The base_url is optional, and you can leave it empty if you are using the official providers.

Advanced Config

  • generation.temperature: The temperature setting for the model.
  • generation.top_p: The top-p setting for the model.
  • generation.with_tools: Whether to use the tools in the generation.
  • default_model: The default model to use.
  • default_system_message: The default system message name to use. See the system_messages section.
  • contexts: The contexts to use.
  • history_context_options.size: The nunber of lines of the history context.
  • history_context_options.all_panes: Whether to use all panes in the history context.
  • system_messages: The list of available system messages, and you can add your own ones.

Example

Ask what happened in this session:

term_assistant talk "what happened"

You can specify the model if you do not want to use the default model:

term_assistant talk "what happened" -m openai/gpt-4o-mini

You can also specify the system messages:

term_assistant talk "how to install nginx" -s "another_assistant_prompt"

Or you can directly pass the system message:

term_assistant talk "how to use tmux" -s "You are a terminal assistant, and you must not answer the questions unrelated to terminal."

Logging

The chat context, user prompts, model responses, etc. will be recorded to the log file ~/.assistant.log.

Contributing

If you would like to contribute to the project, please submit a pull request or create an issue regarding any bug or idea for improvement.

You can download the repository and install the development dependencies.

$ git clone https://github.com/SiriusKoan/term-assistant.git
$ poetry install

Also you can build the package and install it locally.

$ poetry build
$ pip install dist/term_assistant-0.1.0-py3-none-any.whl

Metadata

Release files for term-assistant 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for term-assistant 0.1.0
File Size Uploaded
term_assistant-0.1.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for term-assistant 0.1.0
File Interpreter ABI Platform
term_assistant-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / term_assistant-0.1.0.tar.gz

Download URL term_assistant-0.1.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
90f8b77e0ddef0c1934cf4e023f0c0928e2b5108536f4c19cd9fca2a5a75831a
BLAKE2b-256 checksum
How to use checksums
0cd319191081fab5341ce9b67c87283f9ef3a4d5f8e6ea9fe01b4d24f42ea281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.12.6-amd64

Release files / term_assistant-0.1.0-py3-none-any.whl

Download URL term_assistant-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
607b22f77de4e1f07f27759e6f54335fc8501bab9eb335aff94f2de85ba8d351
BLAKE2b-256 checksum
How to use checksums
0e29b6de3cbd81c8ae3809f3b6ddad22dfed60a1d9f23c540d040f362569107c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.12.6-amd64

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page