Try to Fix Embeding RAG Persisted Issues ...
This commit is contained in:
@@ -192,6 +192,7 @@ namespace xAiApi.Controllers
|
||||
var result = await aiService.AskTextFromKnowledgeAsync(
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
cancellationToken: cancellationToken
|
||||
@@ -244,6 +245,7 @@ namespace xAiApi.Controllers
|
||||
var enumerable = aiService.AskTextFromKnowledgeAsEnumerable(
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
cancellationToken: cancellationToken
|
||||
@@ -288,7 +290,7 @@ namespace xAiApi.Controllers
|
||||
|
||||
//
|
||||
await Response.WriteSseErrorAsync(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,6 +325,7 @@ namespace xAiApi.Controllers
|
||||
files: null,
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
connectionId: connectionId,
|
||||
@@ -379,6 +382,7 @@ namespace xAiApi.Controllers
|
||||
files: null,
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
connectionId: connectionId,
|
||||
@@ -463,6 +467,7 @@ namespace xAiApi.Controllers
|
||||
files: null,
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
connectionId: connectionId,
|
||||
@@ -520,6 +525,7 @@ namespace xAiApi.Controllers
|
||||
files: files,
|
||||
topK: request.TopK,
|
||||
userInfo: userInfo,
|
||||
type: request.Type,
|
||||
prompt: request.Prompt,
|
||||
minScore: request.MinScore,
|
||||
connectionId: connectionId,
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace xAiApi.Interfaces
|
||||
/// Ask a Question By Rag Retrive From Knowledge ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
@@ -91,6 +92,7 @@ namespace xAiApi.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<string> AskTextFromKnowledgeAsync(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
@@ -101,6 +103,7 @@ namespace xAiApi.Interfaces
|
||||
/// Ask a Question By Rag Retrive From Knowledge and Stream Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
@@ -108,6 +111,7 @@ namespace xAiApi.Interfaces
|
||||
/// <returns></returns>
|
||||
IAsyncEnumerable<string> AskTextFromKnowledgeAsEnumerable(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
@@ -118,6 +122,7 @@ namespace xAiApi.Interfaces
|
||||
/// Ask a Question as Prompt and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="projectId"></param>
|
||||
@@ -129,6 +134,7 @@ namespace xAiApi.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<XAiMessageDto> AskAsync(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
Guid? projectId = null,
|
||||
@@ -143,6 +149,7 @@ namespace xAiApi.Interfaces
|
||||
/// Ask a Question as Prompt and Retrieve Response as Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="projectId"></param>
|
||||
@@ -154,6 +161,7 @@ namespace xAiApi.Interfaces
|
||||
/// <returns></returns>
|
||||
IAsyncEnumerable<XAiResonseMessage> AskAsEnumerable(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
Guid? projectId = null,
|
||||
|
||||
@@ -269,6 +269,7 @@ namespace xAiApi.Providers
|
||||
/// Ask a Question By Rag Retrive From Knowledge ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
@@ -276,6 +277,7 @@ namespace xAiApi.Providers
|
||||
/// <returns></returns>
|
||||
public virtual async Task<string> AskTextFromKnowledgeAsync(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
@@ -316,12 +318,17 @@ namespace xAiApi.Providers
|
||||
{
|
||||
minScore = configuration.RAGDescriptor.DefaultMinScore;
|
||||
}
|
||||
if (type.IsNullOrEmpty())
|
||||
{
|
||||
type = XAiModelsConstants.XAiDefaultKnowledgeType;
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Knowledge Request ...
|
||||
var knowledgeRequest = new XAiKnowledgeAskRequest
|
||||
{
|
||||
TopK = topK,
|
||||
Type = type,
|
||||
Prompt = prompt,
|
||||
IncludeUser = true,
|
||||
MinScore = minScore,
|
||||
@@ -361,6 +368,7 @@ namespace xAiApi.Providers
|
||||
/// Ask a Question By Rag Retrive From Knowledge and Stream Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
@@ -368,6 +376,7 @@ namespace xAiApi.Providers
|
||||
/// <returns></returns>
|
||||
public virtual async IAsyncEnumerable<string> AskTextFromKnowledgeAsEnumerable(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
@@ -409,12 +418,17 @@ namespace xAiApi.Providers
|
||||
{
|
||||
minScore = configuration.RAGDescriptor.DefaultMinScore;
|
||||
}
|
||||
if (type.IsNullOrEmpty())
|
||||
{
|
||||
type = XAiModelsConstants.XAiDefaultKnowledgeType;
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Knowledge Request ...
|
||||
var knowledgeRequest = new XAiKnowledgeAskRequest
|
||||
{
|
||||
TopK = topK,
|
||||
Type = type,
|
||||
Prompt = prompt,
|
||||
IncludeUser = true,
|
||||
MinScore = minScore,
|
||||
@@ -453,6 +467,7 @@ namespace xAiApi.Providers
|
||||
/// Ask a Question as Prompt and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="projectId"></param>
|
||||
@@ -464,6 +479,7 @@ namespace xAiApi.Providers
|
||||
/// <returns></returns>
|
||||
public virtual async Task<XAiMessageDto> AskAsync(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
Guid? projectId = null,
|
||||
@@ -508,6 +524,10 @@ namespace xAiApi.Providers
|
||||
{
|
||||
minScore = configuration.RAGDescriptor.DefaultMinScore;
|
||||
}
|
||||
if (type.IsNullOrEmpty())
|
||||
{
|
||||
type = XAiModelsConstants.XAiDefaultKnowledgeType;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Project ...
|
||||
@@ -599,6 +619,7 @@ namespace xAiApi.Providers
|
||||
var knowledgeRequest = new XAiKnowledgeAskRequest
|
||||
{
|
||||
TopK = topK,
|
||||
Type = type,
|
||||
Prompt = prompt,
|
||||
IncludeUser = true,
|
||||
MinScore = minScore,
|
||||
@@ -688,6 +709,7 @@ namespace xAiApi.Providers
|
||||
/// Ask a Question as Prompt and Retrieve Response as Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="prompt"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="topK"></param>
|
||||
/// <param name="minScore"></param>
|
||||
/// <param name="projectId"></param>
|
||||
@@ -699,6 +721,7 @@ namespace xAiApi.Providers
|
||||
/// <returns></returns>
|
||||
public virtual async IAsyncEnumerable<XAiResonseMessage> AskAsEnumerable(
|
||||
string prompt,
|
||||
string type = null,
|
||||
int? topK = null,
|
||||
float? minScore = null,
|
||||
Guid? projectId = null,
|
||||
@@ -744,6 +767,10 @@ namespace xAiApi.Providers
|
||||
{
|
||||
minScore = configuration.RAGDescriptor.DefaultMinScore;
|
||||
}
|
||||
if (type.IsNullOrEmpty())
|
||||
{
|
||||
type = XAiModelsConstants.XAiDefaultKnowledgeType;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Project ...
|
||||
@@ -835,6 +862,7 @@ namespace xAiApi.Providers
|
||||
var knowledgeRequest = new XAiKnowledgeAskRequest
|
||||
{
|
||||
TopK = topK,
|
||||
Type = type,
|
||||
Prompt = prompt,
|
||||
IncludeUser = true,
|
||||
MinScore = minScore,
|
||||
|
||||
Reference in New Issue
Block a user