Skip to main content

A command-line AI chat tool for testing various large model APIs

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

termind-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

termind-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file termind-0.1.0.tar.gz.

File metadata

  • Download URL: termind-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for termind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b065009ec4cc6ab768e9fb7c17c6d42f3f89a393c5b99275611a7fdf567515d3
MD5 600cb2724b5b70974893ce396ae98b74
BLAKE2b-256 cee5f0ee9cb64b6ceaa3a49af0f1e88dff31232f6b6aa1968bfc40090a04cbe8

See more details on using hashes here.

File details

Details for the file termind-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: termind-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for termind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 731b3d1f13dd2542350383d1f95f464d6ff83c142c088f4ccd8d3f61457554ab
MD5 8eaf0140e1daba239270b54cad8134b9
BLAKE2b-256 fef0304d501c001bc908a9924a4acf65ba9a3aaf7e709cccc7c30f654e2edb46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page