add TextChunker Service for AI Project ...
This commit is contained in:
@@ -15,6 +15,7 @@ using xExceptions.Constants;
|
||||
using Microsoft.Extensions.AI;
|
||||
using System.Collections.Generic;
|
||||
using System.ClientModel.Primitives;
|
||||
using xAiApi.Models;
|
||||
|
||||
namespace xAiApi.Extensions
|
||||
{
|
||||
@@ -36,7 +37,26 @@ namespace xAiApi.Extensions
|
||||
source.Prompts.Any(p => p.Name
|
||||
.Equals(
|
||||
XAiApiConstants.XAiApiIntroductionPromptName,
|
||||
System.StringComparison.InvariantCultureIgnoreCase));
|
||||
StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check TextChunker Descriptor is Valid or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XTextChunkerDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.ChunkSize > 0 &&
|
||||
source.ChunkOverlap >= 0 &&
|
||||
source.ChunkOverlap < source.ChunkSize &&
|
||||
source.MinChunkSize >= 0 &&
|
||||
source.MinChunkSize <= source.ChunkSize;
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user