117 lines
3.5 KiB
C#
117 lines
3.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.AI;
|
|
using Microsoft.SemanticKernel.ChatCompletion;
|
|
using xAiApi.AI.Configuration;
|
|
|
|
namespace xAiApi.AI.Interfaces
|
|
{
|
|
public interface IXAIService
|
|
{
|
|
/// <summary>
|
|
/// Provides Options for Chat ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
ChatOptions ChatOptions { get; }
|
|
|
|
/// <summary>
|
|
/// Provides History for Chat ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
ChatHistory ChatHistory { get; }
|
|
|
|
/// <summary>
|
|
/// a Client for Text Chat ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
IChatClient TextGenreatorClient { get; }
|
|
|
|
/// <summary>
|
|
/// a Client for Code Chat ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
IChatClient CodeGenreatorClient { get; }
|
|
|
|
/// <summary>
|
|
/// a Client for Image Chats ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
IChatClient ImageGenreatorClient { get; }
|
|
|
|
/// <summary>
|
|
/// Configuration ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
XAiApiConfiguration Configuration { get; }
|
|
|
|
//
|
|
#region Actions ...
|
|
/// <summary>
|
|
/// Generated Text ...
|
|
/// </summary>
|
|
/// <param name="prompt"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
Task<string> GetTextResponseAsync(
|
|
string prompt,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>
|
|
/// Generated Response ...
|
|
/// </summary>
|
|
/// <param name="prompt"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
Task<ChatResponse> GetResponseAsync(
|
|
string prompt,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>
|
|
/// Generated Response ...
|
|
/// </summary>
|
|
/// <param name="message">ChatMessage instance</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
Task<ChatResponse> GetResponseByChatMessageAsync(
|
|
ChatMessage message,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>
|
|
/// Generated Response ...
|
|
/// </summary>
|
|
/// <param name="messages">ChatMessage Enumerable instance</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
Task<ChatResponse> GetResponseByChatMessagesAsync(
|
|
IEnumerable<ChatMessage> messages,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>
|
|
/// Generate Text Response Stream ...
|
|
/// </summary>
|
|
/// <param name="prompt"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
IAsyncEnumerable<ChatResponseUpdate> GetReponseStreamAsync(
|
|
string prompt,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>
|
|
/// Generate Text Response Stream ...
|
|
/// </summary>
|
|
/// <param name="prompt"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
IAsyncEnumerable<string> GetTextReponseStreamAsync(
|
|
string prompt,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
#endregion
|
|
}
|
|
} |