top of page

latest stuff in ai, directly in your inbox. 🤗

Thanks for submitting!

Writer's pictureHarsh Majethiya

The Importance of Chat Markup Language (ChatML) in the AI Ecosystem

Chat Markup Language (ChatML), introduced alongside OpenAI's ChatGPT and Whisper APIs on March 1, 2023, is a vital development that promises to enhance the way we interact with AI language models. In this blog post, we will delve into the significance of ChatML and its potential impact on AI-driven conversational interfaces.


Recap of OpenAI's Announcement


The announcement from OpenAI highlighted several key updates:

  1. A dramatic 90% price reduction for the hosted API, ChatGPT, since December 2022.

  2. More granular management and regional/geographic availability zones for APIs hosted on Azure.

  3. Easier implementation and experimentation with the Whisper and ChatGPT APIs, allowing the inclusion of voice data alongside text data.

  4. An increased focus on customer service, fine-tuning, and support for minority languages to differentiate from other ASR vendors.

  5. The option for users to access specific model versions and update as needed, ensuring greater stability for production implementations.

Why ChatML Matters


ChatML is essential for several reasons, the most significant being its ability to protect against prompt injection attacks to a certain extent. It achieves this by segregating conversations into layers or roles, such as System, Assistant, and User.

Although currently at version zero, we can expect further developments and improvements to ChatML in the future. At present, the payload accommodated by ChatML is only text, but OpenAI plans to introduce other data types soon. While users can still opt for the unsafe raw string format, it is more susceptible to injections. OpenAI's introduction of ChatML demonstrates its commitment to guiding and managing the LLM landscape responsibly, setting the standard for application creation.


ChatML Example Code


Here's an example of a ChatML JSON file with the roles defined as System, User, and Assistant:

[
  {"role": "system", "content": "You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible.\nKnowledge cutoff: 2021-09-01\nCurrent date: 2023-03-02"},
  {"role": "user", "content": "How are you?"},
  {"role": "assistant", "content": "I am doing well"},
  {"role": "user", "content": "What is the mission of the company OpenAI?"}
]

And the corresponding Python code snippet:


pip install openai

import os
import openai
openai.api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages = [
    {"role": "system", "content": "You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible.\nKnowledge cutoff: 2021-09-01\nCurrent date: 2023-03-02"},
    {"role": "user", "content": "How are you?"},
    {"role": "assistant", "content": "I am doing well"},
    {"role": "user", "content": "What is the mission of the company OpenAI?"}
  ]
)
#print(completion)
print(completion)

The output will display the role, model detail (gpt-3.5-turbo-0301), and other relevant information.


Closing Thoughts


Designing a conversational interface based on Large Language Models (LLMs) can be challenging due to the intricacies of sequencing prompt nodes into chains. The unstructured nature of input, often in the form of natural language or conversation, exacerbates this, and hence chatLM is an important development.


Comments


TOP AI TOOLS

snapy.ai

Snapy allows you to edit your videos with the power of ai. Save at least 30 minutes of editing time for a typical 5-10 minute long video.

- Trim silent parts of your videos
- Make your content more interesting for your audience
- Focus on making more quality content, we will take care of the editing

Landing AI

A platform to create and deploy custom computer vision projects.

SupaRes

An image enhancement platform.

MemeMorph

A tool for face-morphing and memes.

SuperAGI

SuperAGI is an open-source platform providing infrastructure to build autonomous AI agents.

FitForge

A tool to create personalized fitness plans.

FGenEds

A tool to summarize lectures and educational materials.

Shortwave

A platform for emails productivity.

Publer

An all-in-one social media management tool.

Typeface

A tool to generate personalized content.

Addy AI

A Google Chrome Exntesion as an email assistant.

Notability

A telegrambot to organize notes in Notion.

bottom of page