last ...
This commit is contained in:
@@ -1,34 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xAiApi.Configurations;
|
||||
using xAiApi.Constants;
|
||||
using xAiApi.Models;
|
||||
using xAiModels.Models;
|
||||
using xCommons.Extensions;
|
||||
using xAiModels.Extensions;
|
||||
using xAiApi.Configurations;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xAiApi.Extensions
|
||||
{
|
||||
public static class XModelsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Validate a Model Descriptor ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XAiModelDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
!source.IsNullOrDefault() &&
|
||||
!source.Name.IsNullOrEmpty() &&
|
||||
!source.Url.IsNullOrEmpty() &&
|
||||
source.Url.IsValidUrl() &&
|
||||
!source.LLM.IsNullOrEmpty() &&
|
||||
source.Provider != Constants.XAiProvider.None;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate Configurations ...
|
||||
/// </summary>
|
||||
@@ -51,52 +32,6 @@ namespace xAiApi.Extensions
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate Specified Param ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XAiPromptParam source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
!source.IsNullOrDefault() &&
|
||||
!source.Name.IsNullOrEmpty() &&
|
||||
!source.Param.IsNullOrEmpty();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate Specified Prompt ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XAiPromptDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
!source.IsNullOrDefault() &&
|
||||
!source.Name.IsNullOrEmpty() &&
|
||||
!source.Template.IsNullOrEmpty();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (source.Params.HasChild())
|
||||
{
|
||||
result =
|
||||
result &&
|
||||
source.Params.All(x => x.IsValid());
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract Default Model Descriptor ...
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user