Chats and Messages are how Rigging represents the conversation with a model.
Chat
objects hold a sequence of Message
objects pre and post generation. This is the most common way that we interact with LLMs, and the interface of both these and ChatPipeline
’s are very flexible objects that let you tune the generation process, gather structured outputs, validate parsing, perform text replacements, serialize and deserialize, fork conversations, etc.
ContentImageUrl
class:
ContentAudioInput
class:
ChatPipeline.apply()
and ChatPipeline.apply_to_all()
to swap values prefixed with $
characters inside message contents for fast templating support. This functionality uses string.Template.safe_substitute underneath.
tool_calls
property of the message:
ParsedMessagePart
’s inside their .parts
property. These parts maintain both the instance of the parsed Rigging model object and a .slice_
property that defines exactly where in the message content they are located.
Every time parsing occurs, these parts are re-synced by using .to_pretty_xml()
on the model, and stitching the clean content back into the message, fixing any other slices which might have been affected by the operation, and ordering the .parts
property based on where they occur in the message content.
ChatPipeline.meta()
adds to ChatPipeline.metadata
Chat.meta()
adds to Chat.metadata
Chat.stop_reason
Chat.usage
Chat.extra
transformers
generator doesn’t provide any usage information and the vllm
generator will add metrics information to the extra
field.
We intentionally keep these fields as generic as possible to allow for future expansion. You’ll often find deep information about the generation process in the Chat.extra
field.