last ...
This commit is contained in:
@@ -6,6 +6,7 @@ namespace xAiModels.Constants
|
|||||||
public enum XAiModelProviderType
|
public enum XAiModelProviderType
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
OpenAI,
|
||||||
Ollama,
|
Ollama,
|
||||||
DeepSeek,
|
DeepSeek,
|
||||||
HuggingFace
|
HuggingFace
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using xAiModels.Models;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
@@ -104,5 +106,71 @@ namespace xAiModels.Extensions
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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.XAiModelProviderType.None;
|
||||||
|
|
||||||
|
//
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
namespace xAiModels.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describe Specified Prompt ...
|
||||||
|
/// </summary>
|
||||||
|
public class XAiPromptDescriptor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Name ...
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Template ...
|
||||||
|
/// </summary>
|
||||||
|
public string Template { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Description ...
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Template Params ...
|
||||||
|
/// </summary>
|
||||||
|
public XAiPromptParam[] Params { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specified a Prompt Param ...
|
||||||
|
/// </summary>
|
||||||
|
public class XAiPromptParam
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Param Name ...
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Param Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
public string Param { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parma Description ...
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-2
@@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
<!-- Icon Handling -->
|
<!-- Icon Handling -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../../Documents/Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
<None Include="../../Documents/Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
|
||||||
PackagePath="\icon.png" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Local Modules -->
|
<!-- Local Modules -->
|
||||||
@@ -36,7 +35,9 @@
|
|||||||
|
|
||||||
<!-- Dependencies -->
|
<!-- Dependencies -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="OpenAI" Version="2.14.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.AI" Version="10.4.1" />
|
<PackageReference Include="Microsoft.Extensions.AI" Version="10.4.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.10.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- For XML Documentation Support -->
|
<!-- For XML Documentation Support -->
|
||||||
|
|||||||
Reference in New Issue
Block a user