@@ -14,14 +14,16 @@ var messages = new Chat()
1414 { " user" , " What is 101*3?" },
1515};
1616
17- var grok = new GrokClient (Env .Get (" XAI_API_KEY" )! );
17+ IChatClient grok = new GrokClient (Env .Get (" XAI_API_KEY" )! )
18+ .GetChatClient (" grok-3-mini" )
19+ .AsIChatClient ();
1820
1921var options = new GrokChatOptions
2022{
21- ModelId = " grok-3-mini" , // or "grok-3-mini-fast"
23+ ModelId = " grok-3-mini-fast " , // can override the model on the client
2224 Temperature = 0 . 7 f ,
2325 ReasoningEffort = ReasoningEffort .High , // or ReasoningEffort.Low
24- Search = GrokSearch .Auto , // or GrokSearch.On or GrokSearch.Off
26+ Search = GrokSearch .Auto , // or GrokSearch.On or GrokSearch.Off
2527 };
2628
2729var response = await grok .GetResponseAsync (messages , options );
@@ -38,11 +40,12 @@ var messages = new Chat()
3840 { " user" , " What's Tesla stock worth today? Search X and the news for latest info." },
3941};
4042
41- var grok = new GrokClient (Env .Get (" XAI_API_KEY" )! );
43+ var grok = new GrokClient (Env .Get (" XAI_API_KEY" )! )
44+ .GetChatClient (" grok-3" )
45+ .AsIChatClient ();
4246
4347var options = new ChatOptions
4448{
45- ModelId = " grok-3" ,
4649 Tools = [new HostedWebSearchTool ()]
4750};
4851
@@ -83,6 +86,8 @@ The chat pipeline logging is added similar to other pipeline extensions:
8386
8487``` csharp
8588IChatClient client = new GrokClient (Env .Get (" XAI_API_KEY" )! )
89+ .GetChatClient (" grok-3-mini" )
90+ .AsIChatClient ()
8691 .AsBuilder ()
8792 .UseOpenTelemetry ()
8893 // other extensions...
@@ -95,7 +100,6 @@ IChatClient client = new GrokClient(Env.Get("XAI_API_KEY")!)
95100 .Build ();
96101```
97102
98-
99103<!-- #content -->
100104<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
101105<!-- exclude -->
0 commit comments