Skip to content

LLM Messages (maticlib.messages)

Unified message containers that ensure consistent data formatting across all supported LLM providers.

Core Message Types

Class Role Alias Purpose
SystemMessage system, developer High-level instructions that define the model's behavior.
HumanMessage user, human Direct input from the end-user.
AIMessage assistant, model, ai Responses generated by the LLM or simulated history.

Code Example

from maticlib.messages import HumanMessage, AIMessage, SystemMessage

# Creating a conversation history
history = [
    SystemMessage(content="You are a helpful coding assistant."),
    HumanMessage(content="How do I use MaticGraph?"),
    AIMessage(content="You can initialize it via `MaticGraph()`.")
]

Parameters

  • content (str): The text payload of the message.
  • message_type (MessageType): An internal enum defining the sender role.