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
Returns
AddImage(string)
public MessageChain AddImage(string imagePath)
Parameters
imagePathstring
Returns
AddImageUrl(string)
public MessageChain AddImageUrl(string url)
Parameters
urlstring
Returns
AddText(string)
public MessageChain AddText(string text)
Parameters
textstring
Returns
SendAsync(CancellationToken)
Sends the message using an independent request configuration.
public Task<string> SendAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
SendOnceAsync(CancellationToken)
Sends a one-off request without changing the service default mode.
public Task<string> SendOnceAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
StreamAsync(Action<string>)
Observes streaming text using the captured request configuration.
public Task StreamAsync(Action<string> onContent)
Parameters
Returns
StreamAsync(CancellationToken)
Streams the captured message request.
public IAsyncEnumerable<string> StreamAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
StreamOnceAsync(Action<string>)
Observes streaming text without maintaining conversation history.
public Task StreamOnceAsync(Action<string> onContent)
Parameters
Returns
StreamOnceAsync(CancellationToken)
Streams the captured message as a one-off request.
public IAsyncEnumerable<string> StreamOnceAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
WithHighDetail()
public MessageChain WithHighDetail()
Returns
WithMaxRounds(int)
Sets max rounds for this request
public MessageChain WithMaxRounds(int rounds)
Parameters
roundsint
Returns
WithPolicy(FunctionCallingPolicy)
Sets a custom policy for this request
public MessageChain WithPolicy(FunctionCallingPolicy policy)
Parameters
policyFunctionCallingPolicy
Returns
WithRole(ActorRole)
public MessageChain WithRole(ActorRole role)
Parameters
roleActorRole
Returns
WithTimeout(int)
Sets a custom timeout for this request
public MessageChain WithTimeout(int seconds)
Parameters
secondsint
Returns
WithVisionPolicy()
Uses the Vision-optimized policy (90 seconds timeout)
public MessageChain WithVisionPolicy()