Table of Contents

Class MessageBuilder

Namespace
Mythosia.AI.Builders
Assembly
Mythosia.AI.dll

Fluent builder for creating messages with multiple content types

public class MessageBuilder
Inheritance
MessageBuilder
Inherited Members

Properties

ContentCount

Gets the current content count

public int ContentCount { get; }

Property Value

int

HasContent

Checks if the builder has any content

public bool HasContent { get; }

Property Value

bool

Methods

AddAudio(byte[], string)

Adds audio content (for future use)

public MessageBuilder AddAudio(byte[] audioData, string mimeType)

Parameters

audioData byte[]
mimeType string

Returns

MessageBuilder

AddImage(byte[], string)

Adds image content from byte array

public MessageBuilder AddImage(byte[] imageData, string mimeType)

Parameters

imageData byte[]
mimeType string

Returns

MessageBuilder

AddImage(string)

Adds image content from file path

public MessageBuilder AddImage(string imagePath)

Parameters

imagePath string

Returns

MessageBuilder

AddImageAsync(string)

Adds image content from file path asynchronously

public Task<MessageBuilder> AddImageAsync(string imagePath)

Parameters

imagePath string

Returns

Task<MessageBuilder>

AddImageUrl(string)

Adds image content from URL

public MessageBuilder AddImageUrl(string url)

Parameters

url string

Returns

MessageBuilder

AddImageUrls(params string[])

Adds multiple images from URLs

public MessageBuilder AddImageUrls(params string[] urls)

Parameters

urls string[]

Returns

MessageBuilder

AddImages(params string[])

Adds multiple images from file paths

public MessageBuilder AddImages(params string[] imagePaths)

Parameters

imagePaths string[]

Returns

MessageBuilder

AddText(string)

Adds text content to the message

public MessageBuilder AddText(string text)

Parameters

text string

Returns

MessageBuilder

Build()

Builds the final Message object

public Message Build()

Returns

Message

BuildAndClear()

Builds and returns the message, then clears the builder

public Message BuildAndClear()

Returns

Message

Clear()

Clears all content

public MessageBuilder Clear()

Returns

MessageBuilder

Create()

Creates a new MessageBuilder instance

public static MessageBuilder Create()

Returns

MessageBuilder

QuickTextImage(string, string, ActorRole)

Creates a message with text and image in one call

public static Message QuickTextImage(string text, string imagePath, ActorRole role = ActorRole.User)

Parameters

text string
imagePath string
role ActorRole

Returns

Message

QuickTextImageUrl(string, string, ActorRole)

Creates a message with text and image URL in one call

public static Message QuickTextImageUrl(string text, string imageUrl, ActorRole role = ActorRole.User)

Parameters

text string
imageUrl string
role ActorRole

Returns

Message

WithHighDetail()

Sets high detail mode for the last added image

public MessageBuilder WithHighDetail()

Returns

MessageBuilder

WithRole(ActorRole)

Sets the role for the message

public MessageBuilder WithRole(ActorRole role)

Parameters

role ActorRole

Returns

MessageBuilder