Skip to main content

A package for converting chat messages to and from ChatML format

Project description

pychatml

The pychatml package allows you to convert chat interfaces from and to the ChatML format.

Installation

You can install the pychatml package using pip:

pip install pychatml

What

Makes it easy to integrate between different chat formats and models.

from pychatml.llama2_converter import Llama2

PROMPT = """[INST] Hi, how are you? [/INST] Good thanks!
[INST] Can you help me with this math program? [/INST]"""

converter = Llama2()

converter.to_chatml(PROMPT)
[
    {"role": "user", "content": "Hi, how are you?"},
    {"role": "assistant", "content": "Good thanks!"},
    {"role": "user", "content": "Can you help me with this math program?"},
]

Supported formats

Why?

Motivation tweet https://github.com/OpenAccess-AI-Collective/axolotl/pull/982

Questions?

Create an issue or discussion in this repository.

Or, reach out to our team! @jakob_frick, @__anjor, @maxnajork on X or team@radiantai.com.

How to create a new release

A new release will automatically be published to pypi. For this to happen you need to

  • update the version specificed in setup.py
  • create a git tag with the version you want to release and push it via git push --tags
  • create a new release in Github

A Github action will automatically publish the new version to pypi.

Contributing Guidelines

Thank you for your interest in contributing to our project! Before you begin writing code, it would be helpful if you read these contributing guidelines. Following them will make the contribution process easier and more efficient for everyone involved.

Please note that the project is released with an MIT License.

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

pychatml-0.0.6.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

pychatml-0.0.6-py3-none-any.whl (14.2 kB view hashes)

Uploaded Python 3

Supported by

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