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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
textstringThe 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
textstringThe 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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
textstringThe textual content of the message. Can be
null.attachmentAttachmentThe 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
textstringThe textual content of the message. Can be
null.attachmentAttachmentThe 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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
attachmentAttachmentThe 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
attachmentAttachmentThe 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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
textstringThe textual content of the message. Can be
null.attachmentAttachmentReferenceThe 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
textstringThe textual content of the message. Can be
null.attachmentAttachmentReferenceThe 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
attachmentAttachmentReferenceThe 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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
textstringThe textual content of the message. Can be
null.attachmentsIEnumerable<Attachment>A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be
nullor 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
textstringThe textual content of the message. Can be
null.attachmentsIEnumerable<Attachment>A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be
nullor 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
attachmentsIEnumerable<Attachment>A collection of attachments to associate with this message. Supported formats include images, PDF, DOCX, XLSX, PPTX, HTML, and plain text. Can be
nullor 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
authorRoleAuthorRoleThe role of the message's author, defined by AuthorRole.
textstringThe textual content of the message. Can be
null.attachmentsIEnumerable<AttachmentReference>A collection of attachment references to associate with this message. Can be
nullor 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
textstringThe textual content of the message. Can be
null.attachmentsIEnumerable<AttachmentReference>A collection of attachment references to associate with this message. Can be
nullor 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
attachmentsIEnumerable<AttachmentReference>A collection of attachment references to associate with this message. Can be
nullor 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
authorRoleAuthorRoletextstringThe message text. Normalized to Unix line endings and trimmed; pass
nullto create an empty message.segmentTypeTextSegmentTypeThe 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.