chatmux
Convert to and from common LLM chat schemas.
All implementations are built on pydantic base models to be network ready.
Installation
pip install chatmux
Usage
Fully OpenAI compatible pydantic models
from chatmux.openai import UserMessage, TextContentPart, ImageContentPart, ImageUrl
# Example using Pydantic models (more robust):
user_message = UserMessage(
role="user",
content=[
TextContentPart(type="text", text="Describe this image:"),
ImageContentPart(
type="image_url",
image_url=ImageUrl(url="https://example.com/image.jpg")
)
]
)
openai_messages = [user_message.model_dump(exclude_none=True)] # Convert model to dict
Conversion methods to and from other schemas
from chatmux.convert import oai_to_qwen
qwen_messages = oai_to_qwen(openai_messages)
print(qwen_messages)
# Expected Output (structure based on oai_to_qwen):
# [
# {
# 'role': 'user',
# 'content': [
# {'type': 'text', 'text': 'Describe this image:'},
# {'type': 'image', 'image': 'https://example.com/image.jpg'}
# ]
# }
# ]
Supported Conversions (as implemented in src/chatmux/convert.py):
- OpenAI-like -> Unsloth: Converts messages (potentially from JSONL), handling image URLs/base64, embedding PIL Images. (
oai_to_unsloth) - OpenAI-like -> Qwen: Converts multimodal messages, keeping image URLs as strings but adjusting the content structure. (
oai_to_qwen)
Contributing
Please open an issue before submitting a PR.
License
MIT
Metadata
Release files for chatmux 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chatmux-0.1.5.tar.gz | 16.0 kB | Without provenance | Details for chatmux-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chatmux-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for chatmux-0.1.5-py3-none-any.whl |
Total release size: 31.9 kB
Release files / chatmux-0.1.5.tar.gz
| Download URL | chatmux-0.1.5.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc6c07a43742b75ee5952932fb9131dc24de0fda7a740e9501a1cbcc3885d465
|
|
BLAKE2b-256 checksum How to use checksums |
27ca3a77993cbd076f10b5d988b6dfd1554c67bf8c09cfd05d8307ca5701694a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / chatmux-0.1.5-py3-none-any.whl
| Download URL | chatmux-0.1.5-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bca9690726c51f847678fa1de6a1262417475dbc2f2bace054c0f79db59d5e2
|
|
BLAKE2b-256 checksum How to use checksums |
6042ca988769f71630b5fa840f73eca4c5d9a835a7f0dc400076d745309f09ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for chatmux 0.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.