Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Conversation.ixx File Reference

The conversation a model's prompt template renders, independent of any family. More...

#include <string>
#include <vector>

Classes

struct  Mila::Dnn::Conversation::ToolCall
 One call the model asked for, as a name and a JSON object of arguments. More...
struct  Mila::Dnn::Conversation::Turn
 A single turn in a conversation. More...

Namespaces

namespace  Mila
 Mila main API namespace.

Enumerations

enum class  Mila::Dnn::Conversation::Role { System , User , Assistant , Tool }
 Who produced a turn. More...

Detailed Description

The conversation a model's prompt template renders, independent of any family.

A model's chat template is a property of the checkpoint, so it lives in the library – and a template needs a conversation to render. This is that conversation, in the one shape every family's protocol module reads, so a host describes its exchange once rather than once per family. The shape is not invented here: it is what the checkpoint's own chat_template.jinja takes, which is why HuggingFace spells the same call apply_chat_template(messages).

Deliberately smaller than what an application holds. There is no timestamp, no display state and no correlation id: a template renders none of them, and a field a template cannot reach would only be a second place to keep something correct.

Sits beside the family protocol modules the way ITransformerBlock sits beside the family blocks – the one type they are all written against.

Enumeration Type Documentation

◆ Role

enum class Mila::Dnn::Conversation::Role
exportstrong

Who produced a turn.

Named for the conversation rather than for any template's spelling of it. Llama writes Tool as "ipython" and Qwen renders it as a user turn carrying a tool_response span – both are renderings of the same role, and each family's protocol module owns its own.