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(CancellationToken)

Sends the message using an independent request configuration.

public Task<string> SendAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<string>

SendOnceAsync(CancellationToken)

Sends a one-off request without changing the service default mode.

public Task<string> SendOnceAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<string>

StreamAsync(Action<string>)

Observes streaming text using the captured request configuration.

public Task StreamAsync(Action<string> onContent)

Parameters

onContent Action<string>

Returns

Task

StreamAsync(CancellationToken)

Streams the captured message request.

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

Parameters

cancellationToken CancellationToken

Returns

IAsyncEnumerable<string>

StreamOnceAsync(Action<string>)

Observes streaming text without maintaining conversation history.

public Task StreamOnceAsync(Action<string> onContent)

Parameters

onContent Action<string>

Returns

Task

StreamOnceAsync(CancellationToken)

Streams the captured message as a one-off request.

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