Table of Contents

Interface IAIService

Namespace
Mythosia.AI.Services
Assembly
Mythosia.AI.Abstractions.dll

Core abstraction for AI completion and streaming services. Implement this interface to create custom AI service providers.

public interface IAIService
Extension Methods

Properties

ActivateChat

The currently active chat block containing conversation history.

ChatBlock ActivateChat { get; }

Property Value

ChatBlock

Model

The AI model identifier currently in use.

string Model { get; }

Property Value

string

Provider

The AI provider name (e.g., "OpenAI", "Anthropic").

string Provider { get; }

Property Value

string

StatelessMode

When true, each request is processed independently without maintaining conversation history.

bool StatelessMode { get; set; }

Property Value

bool

SystemMessage

System message for the active chat.

string SystemMessage { get; set; }

Property Value

string

Methods

GetCompletionAsync(Message, AIRequestProfile?, AIRequestContext?, CancellationToken)

Returns the final response, canceling transport and cooperative local work when requested.

Task<string> GetCompletionAsync(Message message, AIRequestProfile? profile = null, AIRequestContext? context = null, CancellationToken cancellationToken = default)

Parameters

message Message
profile AIRequestProfile
context AIRequestContext
cancellationToken CancellationToken

Returns

Task<string>

Remarks

Cancellation does not guarantee remote generation or billing stops.

GetCompletionAsync(string, AIRequestProfile?, AIRequestContext?, CancellationToken)

Returns the final response, canceling transport and cooperative local work when requested.

Task<string> GetCompletionAsync(string prompt, AIRequestProfile? profile = null, AIRequestContext? context = null, CancellationToken cancellationToken = default)

Parameters

prompt string
profile AIRequestProfile
context AIRequestContext
cancellationToken CancellationToken

Returns

Task<string>

Remarks

Cancellation does not guarantee remote generation or billing stops.

StreamAsync(Message, AIRequestContext?, CancellationToken)

IAsyncEnumerable<string> StreamAsync(Message message, AIRequestContext? context = null, CancellationToken cancellationToken = default)

Parameters

message Message
context AIRequestContext
cancellationToken CancellationToken

Returns

IAsyncEnumerable<string>

Remarks

Planned for withdrawal from the public API in the next major release, once the replacement is available. This API remains supported during the minor transition. Use StartRunAsync and the returned run's output stream for new integrations. Execution logic will be preserved behind non-public implementation hooks.

StreamAsync(Message, StreamOptions, AIRequestContext?, CancellationToken)

IAsyncEnumerable<StreamingContent> StreamAsync(Message message, StreamOptions options, AIRequestContext? context = null, CancellationToken cancellationToken = default)

Parameters

message Message
options StreamOptions
context AIRequestContext
cancellationToken CancellationToken

Returns

IAsyncEnumerable<StreamingContent>

Remarks

Planned for withdrawal from the public API in the next major release, once the replacement is available. This API remains supported during the minor transition. Use StartRunAsync and the returned run's output stream for new integrations. Execution logic will be preserved behind non-public implementation hooks.

StreamAsync(string, StreamOptions, CancellationToken)

IAsyncEnumerable<StreamingContent> StreamAsync(string prompt, StreamOptions options, CancellationToken cancellationToken = default)

Parameters

prompt string
options StreamOptions
cancellationToken CancellationToken

Returns

IAsyncEnumerable<StreamingContent>

Remarks

Planned for withdrawal from the public API in the next major release, once the replacement is available. This API remains supported during the minor transition. Use StartRunAsync and the returned run's output stream for new integrations. Execution logic will be preserved behind non-public implementation hooks.

StreamAsync(string, CancellationToken)

IAsyncEnumerable<string> StreamAsync(string prompt, CancellationToken cancellationToken = default)

Parameters

prompt string
cancellationToken CancellationToken

Returns

IAsyncEnumerable<string>

Remarks

Planned for withdrawal from the public API in the next major release, once the replacement is available. This API remains supported during the minor transition. Use StartRunAsync and the returned run's output stream for new integrations. Execution logic will be preserved behind non-public implementation hooks.