Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fef38cad1b |
@@ -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<AccountController> logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
IXIdentityProvider identityProvider,
|
||||||
|
XValidationProvider validationProvider
|
||||||
|
) : base(
|
||||||
|
logger,
|
||||||
|
appConfiguration,
|
||||||
|
identityProvider,
|
||||||
|
validationProvider
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using xCommons.Providers;
|
||||||
|
using xCommons.Configurations;
|
||||||
|
using xIdentityService.Interfaces;
|
||||||
|
using xIdentityHelper.Controllers;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace xAiApi.Controllers {
|
||||||
|
/// <summary>
|
||||||
|
/// Test all Authentication Policies ...
|
||||||
|
/// </summary>
|
||||||
|
public class TestIdentity : XTestIdentityControllerBase {
|
||||||
|
public TestIdentity (
|
||||||
|
ILogger<TestIdentity> logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
IXIdentityProvider identityProvider,
|
||||||
|
XValidationProvider validationProvider
|
||||||
|
) : base (
|
||||||
|
logger,
|
||||||
|
appConfiguration,
|
||||||
|
identityProvider,
|
||||||
|
validationProvider
|
||||||
|
) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -342,7 +342,7 @@ namespace xAiApi.Providers
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build Chat History for RAG:
|
/// Build Chat History for RAG:
|
||||||
/// [System: Introduction] + [System: ChatWithDocuments Prompt + Context Block] + [User: Prompt] ...
|
/// [System: Introduction + ChatWithDocuments Prompt + Context Block] + [User: Prompt] ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="prompt"></param>
|
/// <param name="prompt"></param>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
@@ -353,6 +353,7 @@ namespace xAiApi.Providers
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
var introductionPrompt = configuration.GetPrompt();
|
||||||
var ragPrompt = configuration.GetPrompt(configuration.RAGDescriptor.PromptName);
|
var ragPrompt = configuration.GetPrompt(configuration.RAGDescriptor.PromptName);
|
||||||
if (ragPrompt.IsNullOrEmpty())
|
if (ragPrompt.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@@ -361,12 +362,14 @@ namespace xAiApi.Providers
|
|||||||
|
|
||||||
//
|
//
|
||||||
var contextBlock = BuildContextBlock(context);
|
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<ChatMessage> result =
|
List<ChatMessage> result =
|
||||||
[
|
[
|
||||||
new ChatMessage(ChatRole.System, configuration.GetPrompt()),
|
|
||||||
new ChatMessage(ChatRole.System, systemText),
|
new ChatMessage(ChatRole.System, systemText),
|
||||||
new ChatMessage(ChatRole.User, prompt),
|
new ChatMessage(ChatRole.User, prompt),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -157,9 +157,12 @@ namespace xAiApi.Providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return [.. result
|
result = [.. result
|
||||||
.OrderByDescending(x => x.Score)
|
.OrderByDescending(x => x.Score)
|
||||||
.Take(topK)];
|
.Take(topK)];
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGet(
|
public bool TryGet(
|
||||||
|
|||||||
Reference in New Issue
Block a user