Table of Contents

Class MessageChain

Namespace
Mythosia.AI.Extensions
Assembly
Mythosia.AI.dll

Fluent chain for building and sending messages

public class MessageChain
Inheritance
MessageChain
Inherited Members

Methods

AddImage(byte[], string)

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

Parameters

imageData byte[]
mimeType string

Returns

MessageChain

AddImage(string)

public MessageChain AddImage(string imagePath)

Parameters

imagePath string

Returns

MessageChain

AddImageUrl(string)

public MessageChain AddImageUrl(string url)

Parameters

url string

Returns

MessageChain

AddText(string)

public MessageChain AddText(string text)

Parameters

text string

Returns

MessageChain

SendAsync()

Sends the message and maintains conversation history.

public Task<string> SendAsync()

Returns

Task<string>

SendOnceAsync()

Sends the message as a one-off query without affecting conversation history.

public Task<string> SendOnceAsync()

Returns

Task<string>

StreamAsync(Action<string>)

Sends the message and streams the response (callback version)

public Task StreamAsync(Action<string> onContent)

Parameters

onContent Action<string>

Returns

Task

StreamAsync(CancellationToken)

Streams the response as IAsyncEnumerable

public IAsyncEnumerable<string> StreamAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

IAsyncEnumerable<string>

StreamOnceAsync(Action<string>)

Streams the message as a one-off query (callback version)

public Task StreamOnceAsync(Action<string> onContent)

Parameters

onContent Action<string>

Returns

Task

StreamOnceAsync(CancellationToken)

Streams as one-off query as IAsyncEnumerable

public IAsyncEnumerable<string> StreamOnceAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

IAsyncEnumerable<string>

WithHighDetail()

public MessageChain WithHighDetail()

Returns

MessageChain

WithMaxRounds(int)

Sets max rounds for this request

public MessageChain WithMaxRounds(int rounds)

Parameters

rounds int

Returns

MessageChain

WithPolicy(FunctionCallingPolicy)

Sets a custom policy for this request

public MessageChain WithPolicy(FunctionCallingPolicy policy)

Parameters

policy FunctionCallingPolicy

Returns

MessageChain

WithRole(ActorRole)

public MessageChain WithRole(ActorRole role)

Parameters

role ActorRole

Returns

MessageChain

WithTimeout(int)

Sets a custom timeout for this request

public MessageChain WithTimeout(int seconds)

Parameters

seconds int

Returns

MessageChain

WithVisionPolicy()

Uses the Vision-optimized policy (90 seconds timeout)

public MessageChain WithVisionPolicy()

Returns

MessageChain