using System.Collections.Generic; using System.Threading; namespace Radzen; /// /// Interface for getting chat completions from an AI model with conversation memory. /// public interface IAIChatService { /// /// Streams chat completion responses from the AI model asynchronously with conversation memory. /// /// The user's input message to send to the AI model. /// Optional session ID to maintain conversation context. If null, a new session will be created. /// A cancellation token that can be used to cancel the operation. /// Optional model name to override the configured model. /// Optional system prompt to override the configured system prompt. /// Optional temperature to override the configured temperature. /// Optional maximum tokens to override the configured max tokens. /// Optional endpoint URL to override the configured endpoint. /// Optional proxy URL to override the configured proxy. /// Optional API key to override the configured API key. /// Optional API key header name to override the configured header. /// An async enumerable that yields streaming response chunks from the AI model. IAsyncEnumerable GetCompletionsAsync(string userInput, string? sessionId = null, CancellationToken cancellationToken = default, string? model = null, string? systemPrompt = null, double? temperature = null, int? maxTokens = null, string? endpoint = null, string? proxy = null, string? apiKey = null, string? apiKeyHeader = null); /// /// Gets or creates a conversation session. /// /// The session ID. If null, a new session will be created. /// The conversation session. ConversationSession GetOrCreateSession(string? sessionId = null); /// /// Clears the conversation history for a specific session. /// /// The session ID to clear. void ClearSession(string sessionId); /// /// Gets all active conversation sessions. /// /// A list of active conversation sessions. IEnumerable GetActiveSessions(); /// /// Removes old conversation sessions based on age. /// /// Maximum age in hours for sessions to keep. void CleanupOldSessions(int maxAgeHours = 24); }