File tree Expand file tree Collapse file tree 5 files changed +54
-1
lines changed
Expand file tree Collapse file tree 5 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 1+ ![ Icon] ( assets/icon.png ) Grok Client (gRPC)
2+ ============
3+
4+ [ ![ EULA] ( https://img.shields.io/badge/EULA-OSMF-blue?labelColor=black&color=C9FF30 )] ( osmfeula.txt )
5+ [ ![ OSS] ( https://img.shields.io/github/license/devlooped/oss.svg?color=blue )] ( license.txt )
6+ [ ![ Version] ( https://img.shields.io/nuget/vpre/Devlooped.GrokClient.svg?color=royalblue )] ( https://www.nuget.org/packages/Devlooped.GrokClient )
7+ [ ![ Downloads] ( https://img.shields.io/nuget/dt/Devlooped.GrokClient.svg?color=green )] ( https://www.nuget.org/packages/Devlooped.GrokClient )
8+
9+ A full XAI/Grok client based on the official full gRPC API.
10+
11+ <!-- include https://github.com/devlooped/.github/raw/main/osmf.md -->
12+
13+ <!-- #content -->
14+ ## Usage
15+
16+ ``` csharp
17+ var builder = Host .CreateApplicationBuilder (args ); // or WebApplication.CreateBuilder(args);
18+
19+ builder .Services .AddGrokClient (Environment .GetEnvironmentVariable (" XAI_API_KEY" )! );
20+
21+ var app = builder .Build ();
22+ ```
23+
24+ This package leverages the [ gRPC client factory] ( https://learn.microsoft.com/en-us/aspnet/core/grpc/clientfactory )
25+ integration for seamless dependency injection:
26+
27+ ``` csharp
28+ class MyService (Chat.ChatClient chat , Documents.DocumentsClient docs , Embedder.EmbedderClient embed )
29+ {
30+ // use clients
31+ }
32+ ```
33+
34+ ## Auto-updating
35+
36+ This project contains an automated mechanism to always fetch the latest version
37+ of the official .proto files from XAI, ensuring it remains up-to-date with any changes
38+ or additions made to the API as soon as they are published.
39+
40+ See for example the [ introduction of tool output and citations] ( https://github.com/devlooped/GrokClient/pull/3 ) .
41+
42+ <!-- #content -->
43+
44+ <!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public async Task ListModelsAsync()
1212 var services = new ServiceCollection ( )
1313 . AddGrokClient ( Environment . GetEnvironmentVariable ( "XAI_API_KEY" ) ! )
1414 . BuildServiceProvider ( ) ;
15-
15+
1616 var client = services . GetRequiredService < Models . ModelsClient > ( ) ;
1717
1818 var models = await client . ListLanguageModelsAsync ( ) ;
You can’t perform that action at this time.
0 commit comments