A simple library for creating and manipulating chat and message objects for LLM applications
Project description
chat-object
A simple library for creating and managing chat objects and messages for LLM applications.
Installation
pip install chat-object
Quick Start
import openai
from chat_object import Chat, Message, Role
client = openai.OpenAI()
chat = Chat(
Message(Role.System, "You are a helpful assistant"),
Message(Role.User, "Hello!")
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=chat.as_dict()
)
print(response.choices[0].message.content)
[!TIP] See example_usage.py for more examples.
Features
- Well-tested code: Comprehensive test coverage with doctests throughout the codebase
- Type safety: Full type hints and enum-based roles
- Backward compatibility: almost seamless integration with existing APIs
- Immutable design: Safe message handling with copy methods
License
This project is licensed under the MIT License. See the LICENSE file for details.
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_object-1.0.0.tar.gz.
File metadata
- Download URL: chat_object-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67005330531a2cbafd90731008a4f7d2c01709b99d5218d23b144cf32e851ccb
|
|
| MD5 |
42266c42bc87924d2fb108e5a7ad7556
|
|
| BLAKE2b-256 |
505c10c30f5af04a8439b95003988cb53e85d309fc646af6eb07aa4603ab050b
|
File details
Details for the file chat_object-1.0.0-py3-none-any.whl.
File metadata
- Download URL: chat_object-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0cb3d45c966f8feadbf747d926c02238346c763eda5beb4f13752164f61858f
|
|
| MD5 |
bdbac1159f0e99f480b4a98519ac1147
|
|
| BLAKE2b-256 |
9ca03ce263b1ddac7a38075660217dfe5d06abdbf8b98a9b0bab6d713d1a3028
|