Tools for human-machine interaction based on large language models.
Project description
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
# default model is `gpt-oss:120b`
from chattools import OllamaChat
description="Intelligent enough to help me for anything."
name="Asistant"
with OllamaChat(description=description, name=name) as chat:
chat.run()
if __name__ == "__main__":
from fire import Fire
Fire()
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chat_tools-2.2.tar.gz.
File metadata
- Download URL: chat_tools-2.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76f0a4b9e671782674010d1299f99feb0fd00f6237e6b658d64e2c517c36c3e3
|
|
| MD5 |
46c8b0bc5cf2304eac0ec88e60c32ab9
|
|
| BLAKE2b-256 |
d6f2b49d96b40c73e97bcd3d37d51a141c6166cad8c227eb6cfe22fe44abb30d
|
Provenance
The following attestation bundles were made for chat_tools-2.2.tar.gz:
Publisher:
python-publish.yml on Freakwill/chat-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chat_tools-2.2.tar.gz -
Subject digest:
76f0a4b9e671782674010d1299f99feb0fd00f6237e6b658d64e2c517c36c3e3 - Sigstore transparency entry: 828594255
- Sigstore integration time:
-
Permalink:
Freakwill/chat-tools@0add5f92d8226063a63d117c56240adc1c6bd3e0 -
Branch / Tag:
refs/tags/v2.2 - Owner: https://github.com/Freakwill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0add5f92d8226063a63d117c56240adc1c6bd3e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chat_tools-2.2-py3-none-any.whl.
File metadata
- Download URL: chat_tools-2.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
770ef5ae12e814a0e04e975ba7006d73458cf746bd5060250010b2cd67b6cd17
|
|
| MD5 |
dfcdf79d6f536b407719d030af4e6320
|
|
| BLAKE2b-256 |
2aad57fb3cccef4ddcecd4a2647f6692b6294e8814384779e1242c1fb387080e
|
Provenance
The following attestation bundles were made for chat_tools-2.2-py3-none-any.whl:
Publisher:
python-publish.yml on Freakwill/chat-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chat_tools-2.2-py3-none-any.whl -
Subject digest:
770ef5ae12e814a0e04e975ba7006d73458cf746bd5060250010b2cd67b6cd17 - Sigstore transparency entry: 828594289
- Sigstore integration time:
-
Permalink:
Freakwill/chat-tools@0add5f92d8226063a63d117c56240adc1c6bd3e0 -
Branch / Tag:
refs/tags/v2.2 - Owner: https://github.com/Freakwill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0add5f92d8226063a63d117c56240adc1c6bd3e0 -
Trigger Event:
push
-
Statement type: