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()
Sends the message and maintains conversation history.
public Task<string> SendAsync()
Returns
SendOnceAsync()
Sends the message as a one-off query without affecting conversation history.
public Task<string> SendOnceAsync()
Returns
StreamAsync(Action<string>)
Sends the message and streams the response (callback version)
public Task StreamAsync(Action<string> onContent)
Parameters
Returns
StreamAsync(CancellationToken)
Streams the response as IAsyncEnumerable
public IAsyncEnumerable<string> StreamAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
StreamOnceAsync(Action<string>)
Streams the message as a one-off query (callback version)
public Task StreamOnceAsync(Action<string> onContent)
Parameters
Returns
StreamOnceAsync(CancellationToken)
Streams as one-off query as IAsyncEnumerable
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()