Skip to main content

Termind

License: MIT Python Version PyPI Version

中文 | English

Termind is a command-line AI chat tool focused on providing simple and efficient chat conversation functionality. It supports calling multiple LLM APIs and can be used as a testing tool for various LLM APIs.

Features

  • Multi-model Support: Supports calling APIs of multiple LLMs such as ChatGPT, DeepSeek, Qwen, and Doubao.
  • Context Memory: Can remember chat context to provide a coherent conversation experience.
  • Command-line Interaction: Interacts with users through a command-line interface, simple and efficient.
  • API Key Management: Supports configuration and management of API keys for multiple models.
  • Multi-language Support: Supports chat conversations in multiple languages including Chinese and English.
  • Custom Commands: Users can define custom commands for quick execution of specific operations.

Architecture

The architecture of Termind is designed with modularity in mind and mainly consists of the following core modules:

  • Model Adapters: Responsible for connecting with different large model APIs and handling API requests and responses.
  • Conversation Manager: Manages the context of chat conversations to ensure conversational coherence.
  • Command-line Interface: Provides a user-friendly command-line interaction interface.
  • API Key Manager: Securely stores and manages API keys for each model.
  • Configuration Manager: Handles the project's configuration files, including model selection, language settings, etc.

Session Management

sequenceDiagram
    participant User
    participant Termind
    participant LLM

    User->>Termind: termind ask "你好"
    Termind->>Termind: 生成 session_id=20240520_1530
    Termind->>LLM: 发送初始请求
    LLM-->>Termind: 响应内容
    Termind-->>User: 显示回复 + 保存session

    User->>Termind: termind ask "继续上文" --session 20240520_1530
    Termind->>Termind: 加载历史消息
    Termind->>LLM: 发送完整上下文
    LLM-->>Termind: 基于上下文的响应

Installation and Usage

Installation

Install Termind via PyPI:

pip install termind

Configuration

For the first use, you need to configure the API keys for each model:

termind config

Follow the prompts to enter the API keys for each model and complete the configuration.

Usage

Start Termind:

termind

In the command-line interface, you can chat with the selected large model. You can enter commands to switch models, view history, etc.

Available Commands:

  • chat: Start chatting with the current model
  • setmodel <model_name>: Set the current model
  • setkey <model_name> <api_key>: Set API key for a model
  • setlang <zh|en>: Set language to Chinese or English
  • setcontext <length>: Set context length
  • config: Show current configuration
  • exit: Exit the program
  • help: Show help information

Example:

Termind > chat
Start Chat
Type your message and press Enter to send, type 'exit' to end chat, type 'clear' to clear history

You: Hello, how are you?
Assistant: I'm just a program, but I'm functioning well. How can I assist you today?

You: What's the weather like today?
Assistant: I don't have access to real-time data, but you can check a weather website or app for the latest information.

You: clear
History cleared

You: exit
Thank you for using Termind. Goodbye!

Contribution Guidelines

Welcome developers to contribute code, suggest improvements, or report issues for Termind. For specific contribution methods, please refer to the project's contribution guidelines.

License

Termind is licensed under the MIT License, allowing free use, modification, and distribution.

Metadata

Release files for termind 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 termind 0.1.0
File Size Uploaded
termind-0.1.0.tar.gz 9.2 kB Details

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / termind-0.1.0.tar.gz

Download URL termind-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b065009ec4cc6ab768e9fb7c17c6d42f3f89a393c5b99275611a7fdf567515d3
BLAKE2b-256 checksum
How to use checksums
cee5f0ee9cb64b6ceaa3a49af0f1e88dff31232f6b6aa1968bfc40090a04cbe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

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

Download URL termind-0.1.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
731b3d1f13dd2542350383d1f95f464d6ff83c142c088f4ccd8d3f61457554ab
BLAKE2b-256 checksum
How to use checksums
fef0304d501c001bc908a9924a4acf65ba9a3aaf7e709cccc7c30f654e2edb46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

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