Skip to main content

chattools

The most simple tool for AI chat, such as gemini, deepseek, ollama

plz save the API keys in .env.key file in the current path.

Example

run python path/to/test.py (deepseek)

run python path/to/test-mistral.py to utilize mistral AI.

Make CLI

create ollama-chat.py

#!/usr/bin/env python3

# default model is `gpt-oss:120b`

from chat_tools import OllamaChat

description="Intelligent enough to help me for anything."
name="Asistant"

with OllamaChat(description=description, name=name) as chat:
    chat.run()

run chmod dommand and ollama-chat.py

Code

# import YourLLM API 
from mixin import ChatMixin
from utils import get_api_key

# api_key = get_api_key


class YourChat(ChatMixin, YourLLM):

    def __init__(self, description=None, history=[], name='Assistant', model="model-name", *args, **kwargs):
        super().__init__(api_key=api_key, *args, **kwargs)  # init method of super class
        self.description = description
        self.name = name
        self.model = model
        self.chat_params = {}

        self.history = history

    def _reply(self, messages, max_retries=100):
        """The wrapper method of the original `chat` method
        """

        k = 0
        while True:
            # try `max_retries` times
            try:
                """
                get the response of the model. such as 
                self.chat.completions.create(
                        model=self.model,
                        messages=messages,
                        **self.chat_params)
                """
            except:
                ...

Commands

register a command as follows

from chat_tools.commands import Commands

@Commands.register("read")
def read_history(obj, path):
    # obj.history = read from `path`
    pass

use the command in the chat as !read path


Metadata

Release files for chat-tools 3.2

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

Source distribution (sdist)

Source distribution for chat-tools 3.2
File Size Uploaded
chat_tools-3.2.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chat-tools 3.2
File Interpreter ABI Platform
chat_tools-3.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / chat_tools-3.2.tar.gz

Download URL chat_tools-3.2.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
958f4e0fc6f50e74bc50192ae9208f26dbf78dae3474cf315af8dbcf35df954b
BLAKE2b-256 checksum
How to use checksums
c77c4d7b4446891fd9345f1df7efbd8449695ed6a6a295804e936253b4608c4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.

Transparency log

Release files / chat_tools-3.2-py3-none-any.whl

Download URL chat_tools-3.2-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
457244790b07e9928fa2915e2b26c1cb6546cd835f9793f868585167fdbe5f76
BLAKE2b-256 checksum
How to use checksums
580bc41dde94094bad21554183752e322145738bf97e57acfcdb11352234f4d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.2 This release

2 release files

3.1

2 release files

3.0

2 release files

2.3

2 release files

2.2

2 release files

2.1

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