using System;
using xModels.Dtos;
using System.Net.Http;
using System.Threading;
using xAiModels.Models;
using xAiModels.Models.Dtos;
using System.Threading.Tasks;
using Microsoft.Extensions.AI;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
namespace xAiApi.Interfaces
{
///
/// Describe a Base Service Actions of any Ai Based Services ...
///
public interface IXAiServiceBase : IDisposable
{
///
/// Chat Options ...
///
ChatOptions Options { get; }
///
/// Descriptor of Models which used in Service ...
///
XAiModelDescriptor Descriptor { get; }
//
#region Actions ...
///
/// Base Method for Communicate with LLM ...
///
///
///
///
Task AskTextAsync(
string prompt,
CancellationToken cancellationToken = default
);
///
/// Base Method for Communicate with LLM ...
///
///
///
///
IAsyncEnumerable AskTextAsEnumerable(
string prompt,
CancellationToken cancellationToken = default
);
///
/// Get LLM Client instance for Communicating with LLM ...
///
///
IChatClient GetClient();
///
/// Create Custom HttpClient for Communicating with LLM API ...
///
///
///
HttpClient GetHttpClient(string url = null);
///
/// Prepare a Message History List for LLM Communication based on Prompt ...
///
///
///
///
IList GetHistory(
string prompt = null,
bool forcePrompt = true
);
///
/// Prepare a Message History List for LLM Communication based on Prompt ...
///
///
///
///
IList GetHistory(
ChatMessage message = null,
bool forceMessage = true
);
#endregion
//
#region Data Provider Based Actions ...
///
/// Load AI Projects ...
///
///
///
///
///
///
Task> LoadProjects(
string ownerId,
string connectionId = null,
bool includeDefaults = false,
CancellationToken cancellationToken = default
);
///
/// Load Conversations of Specified AI Project ...
///
///
///
///
///
Task> LoadConversations(
Guid projectId,
string connectionId = null,
CancellationToken cancellationToken = default
);
///
/// Load Messages of Specified Conversation ...
///
///
///
///
Task> LoadMessages(
Guid conversationId,
CancellationToken cancellationToken = default
);
///
/// Query Projects ...
///
///
///
///
///
Task> QueryProjects(
string ownerId,
XQuery query,
CancellationToken cancellationToken = default
);
///
/// Query Conversations ...
///
///
///
///
///
///
Task> QueryConversations(
string ownerId,
Guid projectId,
XQuery query,
CancellationToken cancellationToken = default
);
///
/// Query Messages ...
///
///
///
///
///
///
Task> QueryMessages(
string ownerId,
Guid conversationId,
XQuery query,
CancellationToken cancellationToken = default
);
///
/// Create an AI Project ...
///
///
///
///
///
///
Task CreateProject(
string ownerId,
XAiProjectDto item,
string connectionId = null,
CancellationToken cancellationToken = default
);
///
/// Create an AI Conversation ...
///
///
///
///
///
///
///
Task CreateConversation(
string ownerId,
Guid projectId,
XAiConversationDto item,
string connectionId = null,
CancellationToken cancellationToken = default
);
///
/// Ask a Question as Prompt and Retrieve Response ...
///
///
///
///
///
///
///
///
///
Task AskAsync(
string prompt,
string ownerId,
Guid projectId,
Guid conversationId,
string connectionId = null,
IFormFileCollection files = null,
CancellationToken cancellationToken = default
);
///
/// Ask a Question as Prompt and Retrieve Response as Async Enumerable ...
///
///
///
///
///
///
///
///
///
IAsyncEnumerable AskAsEnumerable(
string prompt,
string ownerId,
Guid projectId,
Guid conversationId,
string connectionId = null,
IFormFileCollection files = null,
CancellationToken cancellationToken = default
);
#endregion
}
}