last ...
This commit is contained in:
@@ -34,7 +34,7 @@ namespace xAiApi.Controllers
|
||||
/// <summary>
|
||||
/// Default AI Service ...
|
||||
/// </summary>
|
||||
private readonly IXDefaultAiService aiService;
|
||||
private readonly IXAiService aiService;
|
||||
|
||||
/// <summary>
|
||||
/// Text Chunker Service ...
|
||||
@@ -62,8 +62,8 @@ namespace xAiApi.Controllers
|
||||
private readonly IXFileContentExtractor fileContentExtractor;
|
||||
|
||||
public ChatWithDocumentsController(
|
||||
IXAiService aiService,
|
||||
IXTextChunker textChunker,
|
||||
IXDefaultAiService aiService,
|
||||
IXInMemoryVectorStore vectorStore,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace xAiApi.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("[controller]")]
|
||||
public class DefaultAiController : XAiServiceControllerBase<IXDefaultAiService>
|
||||
public class XAiController : XAiServiceControllerBase<IXAiService>
|
||||
{
|
||||
public DefaultAiController(
|
||||
ILogger<DefaultAiController> logger,
|
||||
IXDefaultAiService aiService,
|
||||
public XAiController(
|
||||
ILogger<XAiController> logger,
|
||||
IXAiService aiService,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider
|
||||
@@ -96,7 +96,7 @@ namespace xAiApi.DI
|
||||
)
|
||||
{
|
||||
//
|
||||
source.AddScoped<IXDefaultAiService, XDefaultAiService>();
|
||||
source.AddScoped<IXAiService, XAiService>();
|
||||
source.AddScoped<IXDefaultThinkingAiService, XDefaultThinkingAiService>();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace xAiApi.Interfaces
|
||||
{
|
||||
public interface IXAiService : IXAiServiceBase
|
||||
{ }
|
||||
}
|
||||
@@ -51,53 +51,46 @@ namespace xAiApi.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Prepare a Message History List for LLM Communication based on Prompt ...
|
||||
/// Ask a Question as Prompt and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="forcePrompt"></param>
|
||||
/// <returns></returns>
|
||||
IList<ChatMessage> GetHistory(
|
||||
string prompt = null,
|
||||
bool forcePrompt = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Prepare a Message History List for LLM Communication based on Prompt ...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="forceMessage"></param>
|
||||
/// <returns></returns>
|
||||
IList<ChatMessage> GetHistory(
|
||||
ChatMessage message = null,
|
||||
bool forceMessage = true
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Context Actions ...
|
||||
/// <summary>
|
||||
/// Ask a Question using Provided Context Chunks (RAG) without Persisting ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="conversationId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AskWithContextAsync(
|
||||
Task<XAiMessageDto> AskAsync(
|
||||
string prompt,
|
||||
IEnumerable<XAiVectorSearchResult> context,
|
||||
string ownerId,
|
||||
Guid? projectId,
|
||||
Guid? conversationId,
|
||||
string connectionId = null,
|
||||
IFormFileCollection files = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Ask a Question using Provided Context Chunks (RAG) and Stream Response ...
|
||||
/// Ask a Question as Prompt and Retrieve Response as Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="conversationId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
IAsyncEnumerable<string> AskWithContextAsEnumerable(
|
||||
IAsyncEnumerable<XAiResonseMessage> AskAsEnumerable(
|
||||
string prompt,
|
||||
IEnumerable<XAiVectorSearchResult> context,
|
||||
string ownerId,
|
||||
Guid projectId,
|
||||
Guid conversationId,
|
||||
string connectionId = null,
|
||||
IFormFileCollection files = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
@@ -240,52 +233,5 @@ namespace xAiApi.Interfaces
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Data Actions ...
|
||||
/// <summary>
|
||||
/// Ask a Question as Prompt and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="conversationId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XAiMessageDto> AskAsync(
|
||||
string prompt,
|
||||
string ownerId,
|
||||
Guid? projectId,
|
||||
Guid? conversationId,
|
||||
string connectionId = null,
|
||||
IFormFileCollection files = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Ask a Question as Prompt and Retrieve Response as Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="conversationId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
IAsyncEnumerable<XAiResonseMessage> AskAsEnumerable(
|
||||
string prompt,
|
||||
string ownerId,
|
||||
Guid projectId,
|
||||
Guid conversationId,
|
||||
string connectionId = null,
|
||||
IFormFileCollection files = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace xAiApi.Interfaces
|
||||
{
|
||||
public interface IXDefaultAiService : IXAiServiceBase
|
||||
{ }
|
||||
}
|
||||
+418
-549
File diff suppressed because it is too large
Load Diff
@@ -8,12 +8,12 @@ using xAiApi.Interfaces.Extractors;
|
||||
|
||||
namespace xAiApi.Providers
|
||||
{
|
||||
public class XDefaultAiService : XAIServiceBase, IXDefaultAiService
|
||||
public class XAiService : XAIServiceBase, IXAiService
|
||||
{
|
||||
public XDefaultAiService(
|
||||
public XAiService(
|
||||
IXAiRAGService ragProvider,
|
||||
IXAiDataProvider dataProvider,
|
||||
ILogger<XDefaultAiService> logger,
|
||||
ILogger<XAiService> logger,
|
||||
XAiApiConfiguration configuration,
|
||||
XValidationProvider validationProvider,
|
||||
IXFileContentExtractor fileContentExtractor
|
||||
Reference in New Issue
Block a user