File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ namespace xAI;
77/// <summary>Client for interacting with the Grok service.</summary>
88/// <param name="apiKey">The API key used for authentication.</param>
99/// <param name="options">The options used to configure the client.</param>
10- public class GrokClient ( string apiKey , GrokClientOptions options )
10+ public sealed class GrokClient ( string apiKey , GrokClientOptions options ) : IDisposable
1111{
12- static ConcurrentDictionary < ( Uri , string ) , GrpcChannel > channels = [ ] ;
12+ static readonly ConcurrentDictionary < ( Uri , string ) , GrpcChannel > channels = [ ] ;
1313
1414 /// <summary>Initializes a new instance of the <see cref="GrokClient"/> class with default options.</summary>
1515 public GrokClient ( string apiKey ) : this ( apiKey , new GrokClientOptions ( ) ) { }
@@ -36,6 +36,9 @@ public class GrokClient(string apiKey, GrokClientOptions options)
3636 return GrpcChannel . ForAddress ( Endpoint , options ) ;
3737 } ) ;
3838
39+ /// <summary>Clears the cached list of gRPC channels in the client.</summary>
40+ public void Dispose ( ) => channels . Clear ( ) ;
41+
3942 class AuthenticationHeaderHandler ( string apiKey ) : DelegatingHandler
4043 {
4144 protected override Task < HttpResponseMessage > SendAsync ( HttpRequestMessage request , CancellationToken cancellationToken )
You can’t perform that action at this time.
0 commit comments