diff --git a/dotnet/src/Skills/Skills.Grpc/Extensions/KernelGrpcExtensions.cs b/dotnet/src/Skills/Skills.Grpc/Extensions/KernelGrpcExtensions.cs
index e358addcbbaf..580a6511afcf 100644
--- a/dotnet/src/Skills/Skills.Grpc/Extensions/KernelGrpcExtensions.cs
+++ b/dotnet/src/Skills/Skills.Grpc/Extensions/KernelGrpcExtensions.cs
@@ -27,8 +27,13 @@ public static class KernelGrpcExtensions
/// Semantic Kernel instance.
/// Directory containing the skill directory.
/// Name of the directory containing the selected skill.
+ /// HttpClient to use for sending requests.
/// A list of all the semantic functions representing the skill.
- public static IDictionary ImportGrpcSkillFromDirectory(this IKernel kernel, string parentDirectory, string skillDirectoryName)
+ public static IDictionary ImportGrpcSkillFromDirectory(
+ this IKernel kernel,
+ string parentDirectory,
+ string skillDirectoryName,
+ HttpClient? httpClient = null)
{
const string ProtoFile = "grpc.proto";
@@ -47,7 +52,7 @@ public static IDictionary ImportGrpcSkillFromDirectory(this
using var stream = File.OpenRead(filePath);
- return kernel.RegisterGrpcSkill(stream, skillDirectoryName);
+ return kernel.RegisterGrpcSkill(stream, skillDirectoryName, httpClient);
}
///
@@ -56,11 +61,13 @@ public static IDictionary ImportGrpcSkillFromDirectory(this
/// Semantic Kernel instance.
/// Name of the skill to register.
/// File path to .proto document.
+ /// HttpClient to use for sending requests.
/// A list of all the semantic functions representing the skill.
public static IDictionary ImportGrpcSkillFromFile(
this IKernel kernel,
string skillName,
- string filePath)
+ string filePath,
+ HttpClient? httpClient = null)
{
if (!File.Exists(filePath))
{
@@ -71,7 +78,7 @@ public static IDictionary ImportGrpcSkillFromFile(
using var stream = File.OpenRead(filePath);
- return kernel.RegisterGrpcSkill(stream, skillName);
+ return kernel.RegisterGrpcSkill(stream, skillName, httpClient);
}
///
@@ -80,11 +87,13 @@ public static IDictionary ImportGrpcSkillFromFile(
/// Semantic Kernel instance.
/// .proto document stream.
/// Skill name.
+ /// HttpClient to use for sending requests.
/// A list of all the semantic functions representing the skill.
public static IDictionary RegisterGrpcSkill(
this IKernel kernel,
Stream documentStream,
- string skillName)
+ string skillName,
+ HttpClient? httpClient = null)
{
Verify.NotNull(kernel);
Verify.ValidSkillName(skillName);
@@ -96,7 +105,9 @@ public static IDictionary RegisterGrpcSkill(
var skill = new Dictionary();
- var runner = new GrpcOperationRunner(new HttpClient());
+ var client = HttpClientProvider.GetHttpClient(kernel.Config, httpClient, kernel.Log);
+
+ var runner = new GrpcOperationRunner(client);
foreach (var operation in operations)
{