Table of Contents

Constructor Message

Namespace
LMKit.TextGeneration.Chat
Assembly
LM-Kit.NET.dll

Message(AuthorRole, string)

Initializes a new instance of the ChatHistory.Message class with the specified author role and text.

public Message(AuthorRole authorRole, string text)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

text string

The textual content of the message. Can be null.

Message(string)

Initializes a new instance of the ChatHistory.Message class with the specified text, using User as the default author role.

public Message(string text)

Parameters

text string

The textual content of the message. Can be null.

Message(AuthorRole, string, Attachment)

Initializes a new instance of the ChatHistory.Message class with the specified author role, text, and a single attachment.

public Message(AuthorRole authorRole, string text, Attachment attachment)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

text string

The textual content of the message. Can be null.

attachment Attachment

The attachment to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null.

Remarks

An AttachmentReference pointing to the first page (index 0) is created internally. For multi-page documents such as PDFs, use the constructor overload that accepts an AttachmentReference to target a specific page.

Message(string, Attachment)

Initializes a new instance of the ChatHistory.Message class with the specified text and a single attachment, using User as the default author role.

public Message(string text, Attachment attachment)

Parameters

text string

The textual content of the message. Can be null.

attachment Attachment

The attachment to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null.

Remarks

An AttachmentReference pointing to the first page (index 0) is created internally. For multi-page documents such as PDFs, use the constructor overload that accepts an AttachmentReference to target a specific page.

Message(AuthorRole, Attachment)

Initializes a new instance of the ChatHistory.Message class with the specified author role and a single attachment, without textual content.

public Message(AuthorRole authorRole, Attachment attachment)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

attachment Attachment

The attachment to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null.

Remarks

An AttachmentReference pointing to the first page (index 0) is created internally. For multi-page documents such as PDFs, use the constructor overload that accepts an AttachmentReference to target a specific page.

Message(Attachment)

Initializes a new instance of the ChatHistory.Message class with a single attachment and no textual content, using User as the default author role.

public Message(Attachment attachment)

Parameters

attachment Attachment

The attachment to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null.

Remarks

An AttachmentReference pointing to the first page (index 0) is created internally. For multi-page documents such as PDFs, use the constructor overload that accepts an AttachmentReference to target a specific page.

Message(AuthorRole, string, AttachmentReference)

Initializes a new instance of the ChatHistory.Message class with the specified author role, text, and a single attachment reference.

public Message(AuthorRole authorRole, string text, AttachmentReference attachment)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

text string

The textual content of the message. Can be null.

attachment AttachmentReference

The attachment reference to associate with this message. Can be null.

Remarks

Use this constructor when you need to target a specific page within a multi-page document such as a PDF. The AttachmentReference allows specifying the zero-based page index to include in the conversation context.

Message(string, AttachmentReference)

Initializes a new instance of the ChatHistory.Message class with the specified text and a single attachment reference, using User as the default author role.

public Message(string text, AttachmentReference attachment)

Parameters

text string

The textual content of the message. Can be null.

attachment AttachmentReference

The attachment reference to associate with this message. Can be null.

Remarks

Use this constructor when you need to target a specific page within a multi-page document such as a PDF. The AttachmentReference allows specifying the zero-based page index to include in the conversation context.

Message(AttachmentReference)

Initializes a new instance of the ChatHistory.Message class with a single attachment reference and no textual content, using User as the default author role.

public Message(AttachmentReference attachment)

Parameters

attachment AttachmentReference

The attachment reference to associate with this message. Can be null.

Remarks

Use this constructor when you need to target a specific page within a multi-page document such as a PDF. The AttachmentReference allows specifying the zero-based page index to include in the conversation context.

Message(AuthorRole, string, IEnumerable<Attachment>)

Initializes a new instance of the ChatHistory.Message class with the specified author role, text, and a collection of attachments.

public Message(AuthorRole authorRole, string text, IEnumerable<Attachment> attachments)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

text string

The textual content of the message. Can be null.

attachments IEnumerable<Attachment>

A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null or empty.

Remarks

Each Attachment in the collection is wrapped in an AttachmentReference pointing to the first page (index 0). For multi-page documents such as PDFs where you need to target specific pages, use the constructor overload that accepts AttachmentReference objects instead.

Message(string, IEnumerable<Attachment>)

Initializes a new instance of the ChatHistory.Message class with the specified text and a collection of attachments, using User as the default author role.

public Message(string text, IEnumerable<Attachment> attachments)

Parameters

text string

The textual content of the message. Can be null.

attachments IEnumerable<Attachment>

A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null or empty.

Remarks

Each Attachment in the collection is wrapped in an AttachmentReference pointing to the first page (index 0). For multi-page documents such as PDFs where you need to target specific pages, use the constructor overload that accepts AttachmentReference objects instead.

Message(IEnumerable<Attachment>)

Initializes a new instance of the ChatHistory.Message class with a collection of attachments and no textual content, using User as the default author role.

public Message(IEnumerable<Attachment> attachments)

Parameters

attachments IEnumerable<Attachment>

A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be null or empty.

Remarks

Each Attachment in the collection is wrapped in an AttachmentReference pointing to the first page (index 0). For multi-page documents such as PDFs where you need to target specific pages, use the constructor overload that accepts AttachmentReference objects instead.

Message(AuthorRole, string, IEnumerable<AttachmentReference>)

Initializes a new instance of the ChatHistory.Message class with the specified author role, text, and a collection of attachment references.

public Message(AuthorRole authorRole, string text, IEnumerable<AttachmentReference> attachments)

Parameters

authorRole AuthorRole

The role of the message's author, defined by AuthorRole.

text string

The textual content of the message. Can be null.

attachments IEnumerable<AttachmentReference>

A collection of attachment references to associate with this message. Can be null or empty.

Remarks

Use this constructor when you need to target specific pages within multi-page documents such as PDFs. Each AttachmentReference can specify a zero-based page index, enabling fine-grained control over which pages are included in the conversation context.

Message(string, IEnumerable<AttachmentReference>)

Initializes a new instance of the ChatHistory.Message class with the specified text and a collection of attachment references, using User as the default author role.

public Message(string text, IEnumerable<AttachmentReference> attachments)

Parameters

text string

The textual content of the message. Can be null.

attachments IEnumerable<AttachmentReference>

A collection of attachment references to associate with this message. Can be null or empty.

Remarks

Use this constructor when you need to target specific pages within multi-page documents such as PDFs. Each AttachmentReference can specify a zero-based page index, enabling fine-grained control over which pages are included in the conversation context.

Message(IEnumerable<AttachmentReference>)

Initializes a new instance of the ChatHistory.Message class with a collection of attachment references and no textual content, using User as the default author role.

public Message(IEnumerable<AttachmentReference> attachments)

Parameters

attachments IEnumerable<AttachmentReference>

A collection of attachment references to associate with this message. Can be null or empty.

Remarks

Use this constructor when you need to target specific pages within multi-page documents such as PDFs. Each AttachmentReference can specify a zero-based page index, enabling fine-grained control over which pages are included in the conversation context.

Message(AuthorRole, string, TextSegmentType)

Initializes a new ChatHistory.Message with an explicit initial segment type.

public Message(AuthorRole authorRole, string text, TextSegmentType segmentType)

Parameters

authorRole AuthorRole

The role of the author (e.g., User, Assistant).

text string

The message text. Normalized to Unix line endings and trimmed; pass null to create an empty message.

segmentType TextSegmentType

The segment classification applied to the entire initial content, used for rendering and processing (e.g., UserVisible, ToolInvocation, ToolResponse). Avoid Undefined.

Remarks

Seeds the internal segment map with a single segment starting at index 0 using segmentType. Attachments, token counts, and termination state keep their defaults.