Interface IAIService
Core abstraction for AI completion and streaming services. Implement this interface to create custom AI service providers.
public interface IAIService
Properties
ActivateChat
The currently active chat block containing conversation history.
ChatBlock ActivateChat { get; }
Property Value
Model
The AI model identifier currently in use.
string Model { get; }
Property Value
Provider
The AI provider name (e.g., "OpenAI", "Anthropic").
string Provider { get; }
Property Value
StatelessMode
When true, each request is processed independently without maintaining conversation history.
bool StatelessMode { get; set; }
Property Value
SystemMessage
System message for the active chat.
string SystemMessage { get; set; }
Property Value
Methods
GetCompletionAsync(Message, AIRequestProfile?, AIRequestContext?)
Task<string> GetCompletionAsync(Message message, AIRequestProfile? profile = null, AIRequestContext? context = null)
Parameters
messageMessageprofileAIRequestProfilecontextAIRequestContext
Returns
GetCompletionAsync(string, AIRequestProfile?, AIRequestContext?)
Task<string> GetCompletionAsync(string prompt, AIRequestProfile? profile = null, AIRequestContext? context = null)
Parameters
promptstringprofileAIRequestProfilecontextAIRequestContext
Returns
StreamAsync(Message, AIRequestContext?, CancellationToken)
IAsyncEnumerable<string> StreamAsync(Message message, AIRequestContext? context = null, CancellationToken cancellationToken = default)
Parameters
messageMessagecontextAIRequestContextcancellationTokenCancellationToken
Returns
StreamAsync(Message, StreamOptions, AIRequestContext?, CancellationToken)
IAsyncEnumerable<StreamingContent> StreamAsync(Message message, StreamOptions options, AIRequestContext? context = null, CancellationToken cancellationToken = default)
Parameters
messageMessageoptionsStreamOptionscontextAIRequestContextcancellationTokenCancellationToken
Returns
StreamAsync(string, StreamOptions, CancellationToken)
IAsyncEnumerable<StreamingContent> StreamAsync(string prompt, StreamOptions options, CancellationToken cancellationToken = default)
Parameters
promptstringoptionsStreamOptionscancellationTokenCancellationToken
Returns
StreamAsync(string, CancellationToken)
IAsyncEnumerable<string> StreamAsync(string prompt, CancellationToken cancellationToken = default)
Parameters
promptstringcancellationTokenCancellationToken