@@ -14,7 +14,7 @@ namespace Soenneker.SemanticKernel.Pool.Gemini;
1414/// <summary>
1515/// Provides Gemini-specific registration extensions for KernelPoolManager, enabling integration with local LLMs via Semantic Kernel.
1616/// </summary>
17- public static class KernelPoolGeminiExtension
17+ public static class SemanticKernelPoolGeminiExtension
1818{
1919 /// <summary>
2020 /// Registers a Gemini model in the kernel pool with optional rate and token limits.
@@ -31,7 +31,7 @@ public static class KernelPoolGeminiExtension
3131 /// <param name="tokensPerDay">Optional maximum number of tokens allowed per day.</param>
3232 /// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
3333 /// <returns>A <see cref="ValueTask"/> representing the asynchronous registration operation.</returns>
34- public static ValueTask RegisterGemini ( this IKernelPoolManager pool , string key , string modelId , string apiKey , string endpoint , IHttpClientCache httpClientCache , int ? rps ,
34+ public static ValueTask RegisterGemini ( this ISemanticKernelPool pool , string key , string modelId , string apiKey , string endpoint , IHttpClientCache httpClientCache , int ? rps ,
3535 int ? rpm , int ? rpd , int ? tokensPerDay = null , CancellationToken cancellationToken = default )
3636 {
3737 var options = new SemanticKernelOptions
@@ -47,12 +47,11 @@ public static ValueTask RegisterGemini(this IKernelPoolManager pool, string key,
4747 {
4848 HttpClient httpClient = await httpClientCache . Get ( $ "gemini:{ modelId } ", ( ) => new HttpClientOptions
4949 {
50- Timeout = TimeSpan . FromSeconds ( 600 ) ,
51- BaseAddress = opts . Endpoint
52- } , cancellationToken ) ;
50+ Timeout = TimeSpan . FromSeconds ( 300 )
51+ } , cancellationToken ) . NoSync ( ) ;
5352
5453#pragma warning disable SKEXP0070
55- return Kernel . CreateBuilder ( ) . AddGoogleAIGeminiChatCompletion ( modelId : opts . ModelId ! , apiKey , httpClient : httpClient ) ;
54+ return Kernel . CreateBuilder ( ) . AddGoogleAIGeminiChatCompletion ( modelId : opts . ModelId ! , opts . ApiKey ! , httpClient : httpClient ) ;
5655#pragma warning restore SKEXP0070
5756 }
5857 } ;
@@ -68,7 +67,7 @@ public static ValueTask RegisterGemini(this IKernelPoolManager pool, string key,
6867 /// <param name="httpClientCache">The HTTP client cache to remove the associated client from.</param>
6968 /// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
7069 /// <returns>A <see cref="ValueTask"/> representing the asynchronous unregistration operation.</returns>
71- public static async ValueTask UnregisterGemini ( this IKernelPoolManager pool , string key , IHttpClientCache httpClientCache , CancellationToken cancellationToken = default )
70+ public static async ValueTask UnregisterGemini ( this ISemanticKernelPool pool , string key , IHttpClientCache httpClientCache , CancellationToken cancellationToken = default )
7271 {
7372 await pool . Unregister ( key , cancellationToken ) . NoSync ( ) ;
7473 await httpClientCache . Remove ( $ "gemini:{ key } ", cancellationToken ) . NoSync ( ) ;
0 commit comments