Table of Contents

Class AIServiceExtensions

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

Extension methods for AIService to provide additional convenience features

public static class AIServiceExtensions
Inheritance
AIServiceExtensions
Inherited Members

Methods

AskOnceAsync(AIService, Message)

Performs a one-time multimodal question without affecting the conversation history

public static Task<string> AskOnceAsync(this AIService service, Message message)

Parameters

service AIService
message Message

Returns

Task<string>

AskOnceAsync(AIService, string)

Performs a one-time question without affecting the conversation history

public static Task<string> AskOnceAsync(this AIService service, string prompt)

Parameters

service AIService
prompt string

Returns

Task<string>

AskOnceWithImageAsync(AIService, string, string)

Performs a one-time question with an image

public static Task<string> AskOnceWithImageAsync(this AIService service, string prompt, string imagePath)

Parameters

service AIService
prompt string
imagePath string

Returns

Task<string>

BeginMessage(AIService)

Creates a fluent chain for building and sending a message

public static MessageChain BeginMessage(this AIService service)

Parameters

service AIService

Returns

MessageChain

GetCompletionWithContextAsync(AIService, string, int)

Adds context from previous messages to a new prompt

public static Task<string> GetCompletionWithContextAsync(this AIService service, string prompt, int contextMessages = 5)

Parameters

service AIService
prompt string
contextMessages int

Returns

Task<string>

GetConversationSummary(AIService)

Gets the conversation summary

public static string GetConversationSummary(this AIService service)

Parameters

service AIService

Returns

string

GetLastAssistantResponse(AIService)

Gets the last assistant response from the conversation

public static string? GetLastAssistantResponse(this AIService service)

Parameters

service AIService

Returns

string

RetryLastMessageAsync(AIService)

Retries the last user message if the previous response was unsatisfactory

public static Task<string> RetryLastMessageAsync(this AIService service)

Parameters

service AIService

Returns

Task<string>

StartNewConversation(AIService)

Starts a new conversation, clearing the current history

public static void StartNewConversation(this AIService service)

Parameters

service AIService

StartNewConversation(AIService, string)

Starts a new conversation with a different model

public static void StartNewConversation(this AIService service, string model)

Parameters

service AIService
model string

SwitchModel(AIService, string)

Switches to a different model while preserving conversation history

public static void SwitchModel(this AIService service, string model)

Parameters

service AIService
model string

WithComplexPolicy(AIService)

๋ณต์žกํ•œ ์ž‘์—… ์ •์ฑ…

public static AIService WithComplexPolicy(this AIService service)

Parameters

service AIService

Returns

AIService

WithFastPolicy(AIService)

๋น ๋ฅธ ์‹คํ–‰ ์ •์ฑ…

public static AIService WithFastPolicy(this AIService service)

Parameters

service AIService

Returns

AIService

WithMaxRounds(AIService, int)

์ปค์Šคํ…€ ๋ผ์šด๋“œ ์ œํ•œ

public static AIService WithMaxRounds(this AIService service, int rounds)

Parameters

service AIService
rounds int

Returns

AIService

WithMaxTokens(AIService, uint)

Configures the max tokens for the current chat

public static AIService WithMaxTokens(this AIService service, uint maxTokens)

Parameters

service AIService
maxTokens uint

Returns

AIService

WithNoRetryStructuredOutput(AIService)

retry ์—†์ด 1ํšŒ๋งŒ ์‹œ๋„ํ•˜๋Š” structured output ์ •์ฑ…

public static AIService WithNoRetryStructuredOutput(this AIService service)

Parameters

service AIService

Returns

AIService

WithPolicy(AIService, FunctionCallingPolicy)

์ผํšŒ์„ฑ ์ •์ฑ… ์˜ค๋ฒ„๋ผ์ด๋“œ (Fluent ์Šคํƒ€์ผ)

public static AIService WithPolicy(this AIService service, FunctionCallingPolicy policy)

Parameters

service AIService
policy FunctionCallingPolicy

Returns

AIService

WithStatelessMode(AIService, bool)

Enables or disables stateless mode

public static AIService WithStatelessMode(this AIService service, bool enabled = true)

Parameters

service AIService
enabled bool

Returns

AIService

WithStrictStructuredOutput(AIService)

์ตœ๋Œ€ 3ํšŒ ์žฌ์‹œ๋„ํ•˜๋Š” ์—„๊ฒฉ structured output ์ •์ฑ…

public static AIService WithStrictStructuredOutput(this AIService service)

Parameters

service AIService

Returns

AIService

WithStructuredOutputPolicy(AIService, StructuredOutputPolicy)

์ผํšŒ์„ฑ structured output ์ •์ฑ… ์˜ค๋ฒ„๋ผ์ด๋“œ (Fluent ์Šคํƒ€์ผ). ๋‹ค์Œ GetCompletionAsync<T>() ํ˜ธ์ถœ์—๋งŒ ์ ์šฉ๋˜๋ฉฐ ํ˜ธ์ถœ ํ›„ ์ž๋™์œผ๋กœ ์ดˆ๊ธฐํ™”๋ฉ๋‹ˆ๋‹ค.

public static AIService WithStructuredOutputPolicy(this AIService service, StructuredOutputPolicy policy)

Parameters

service AIService
policy StructuredOutputPolicy

Returns

AIService

WithSystemMessage(AIService, string)

Adds a system message to the current chat

public static AIService WithSystemMessage(this AIService service, string systemMessage)

Parameters

service AIService
systemMessage string

Returns

AIService

WithTemperature(AIService, float)

Configures the temperature for the current chat

public static AIService WithTemperature(this AIService service, float temperature)

Parameters

service AIService
temperature float

Returns

AIService

WithTimeout(AIService, int)

์ปค์Šคํ…€ ํƒ€์ž„์•„์›ƒ

public static AIService WithTimeout(this AIService service, int seconds)

Parameters

service AIService
seconds int

Returns

AIService