add all requirements for implementing XAiMcpClient ...
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
using xAiModels.Models;
|
||||
using xCommons.Extensions;
|
||||
using xAiService.Services;
|
||||
using xExceptions.Constants;
|
||||
using xIdentityModels.Models;
|
||||
using Microsoft.Extensions.AI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xAiService.Extensions
|
||||
{
|
||||
@@ -40,5 +44,35 @@ namespace xAiService.Extensions
|
||||
invalidException.Throw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts To AITools ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="client"></param>
|
||||
/// <returns></returns>
|
||||
public static IList<AITool> ToAITools(
|
||||
this IList<XAiMcpToolDefinition> source,
|
||||
XAiMcpClient client
|
||||
)
|
||||
{
|
||||
//
|
||||
if (client.IsNullOrDefault())
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var result = new List<AITool>();
|
||||
|
||||
//
|
||||
foreach (var tool in source)
|
||||
{
|
||||
result.Add(new XAiMcpAIFunction(client, tool));
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user