diff --git a/Controllers/AccountController.cs b/Controllers/AccountController.cs new file mode 100644 index 0000000..2575e86 --- /dev/null +++ b/Controllers/AccountController.cs @@ -0,0 +1,27 @@ +using xCommons.Providers; +using xCommons.Configurations; +using xIdentityHelper.Controllers; +using xIdentityService.Interfaces; +using Microsoft.Extensions.Logging; + +namespace xAiApi.Controllers +{ + public partial class AccountController : XAccountControllerBase + { + // + #region Constructor ... + public AccountController( + ILogger logger, + XAppConfiguration appConfiguration, + IXIdentityProvider identityProvider, + XValidationProvider validationProvider + ) : base( + logger, + appConfiguration, + identityProvider, + validationProvider + ) + { } + #endregion + } +} \ No newline at end of file diff --git a/Controllers/TestIdentity.cs b/Controllers/TestIdentity.cs new file mode 100644 index 0000000..ec59527 --- /dev/null +++ b/Controllers/TestIdentity.cs @@ -0,0 +1,24 @@ +using xCommons.Providers; +using xCommons.Configurations; +using xIdentityService.Interfaces; +using xIdentityHelper.Controllers; +using Microsoft.Extensions.Logging; + +namespace xAiApi.Controllers { + /// + /// Test all Authentication Policies ... + /// + public class TestIdentity : XTestIdentityControllerBase { + public TestIdentity ( + ILogger logger, + XAppConfiguration appConfiguration, + IXIdentityProvider identityProvider, + XValidationProvider validationProvider + ) : base ( + logger, + appConfiguration, + identityProvider, + validationProvider + ) { } + } +} \ No newline at end of file diff --git a/Providers/XAIServiceBase.cs b/Providers/XAIServiceBase.cs index 6621139..47af7f7 100644 --- a/Providers/XAIServiceBase.cs +++ b/Providers/XAIServiceBase.cs @@ -342,7 +342,7 @@ namespace xAiApi.Providers /// /// Build Chat History for RAG: - /// [System: Introduction] + [System: ChatWithDocuments Prompt + Context Block] + [User: Prompt] ... + /// [System: Introduction + ChatWithDocuments Prompt + Context Block] + [User: Prompt] ... /// /// /// @@ -353,6 +353,7 @@ namespace xAiApi.Providers ) { // + var introductionPrompt = configuration.GetPrompt(); var ragPrompt = configuration.GetPrompt(configuration.RAGDescriptor.PromptName); if (ragPrompt.IsNullOrEmpty()) { @@ -361,12 +362,14 @@ namespace xAiApi.Providers // var contextBlock = BuildContextBlock(context); - var systemText = $"{ragPrompt}{Environment.NewLine}{Environment.NewLine}Context:{Environment.NewLine}{contextBlock}"; + var systemText = + $"{introductionPrompt}{Environment.NewLine}{Environment.NewLine}" + + $"{ragPrompt}{Environment.NewLine}{Environment.NewLine}" + + $"Context:{Environment.NewLine}{contextBlock}"; // List result = [ - new ChatMessage(ChatRole.System, configuration.GetPrompt()), new ChatMessage(ChatRole.System, systemText), new ChatMessage(ChatRole.User, prompt), ]; diff --git a/Providers/XInMemoryVectorStore.cs b/Providers/XInMemoryVectorStore.cs index 53c9126..d00f63e 100644 --- a/Providers/XInMemoryVectorStore.cs +++ b/Providers/XInMemoryVectorStore.cs @@ -157,9 +157,12 @@ namespace xAiApi.Providers } // - return [.. result + result = [.. result .OrderByDescending(x => x.Score) .Take(topK)]; + + // + return result; } public bool TryGet(