using System; using xModels.Dtos; using System.Net.Http; using System.Threading; using xAiModels.Models; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xIdentityModels.Models; 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 ); /// /// 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 Loaders ... /// /// 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 ); #endregion // #region Queries ... /// /// 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 ); #endregion // #region Creators ... /// /// 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 ); #endregion // #region Content Extraction ... /// /// Try to Extract Files Content ... /// /// /// /// /// Task ExtractContent( IFormFileCollection files, string[] extractors = null, CancellationToken cancellationToken = default ); #endregion // #region Data Actions ... /// /// Ask a Question as Prompt and Retrieve Response ... /// /// /// /// /// /// /// /// /// /// Task AskAsync( string prompt, string ownerId, Guid projectId, Guid conversationId, string connectionId = null, IFormFileCollection files = null, XUserClaimsInfoDto userInfo = 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 } }