Skip to content

Commit a1fcd35

Browse files
committed
Document new live search options
1 parent 4bbfa07 commit a1fcd35

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

readme.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,41 @@ var options = new ChatOptions
6262
var response = await grok.GetResponseAsync(messages, options);
6363
```
6464

65+
### Advanced Live Search
66+
67+
To configure advanced live search options, beyond the `On|Auto|Off` settings
68+
in `GrokChatOptions`, you can use the `GrokSearchTool` instead, which exposes
69+
the full breath of [live search options](https://docs.x.ai/docs/guides/live-search)
70+
available in the Grok API.
71+
72+
```csharp
73+
var options = new ChatOptions
74+
{
75+
Tools = [new GrokSearchTool(GrokSearch.On)
76+
{
77+
FromDate = new DateOnly(2025, 1, 1),
78+
ToDate = DateOnly.FromDateTime(DateTime.Now),
79+
MaxSearchResults = 10,
80+
Sources =
81+
[
82+
new GrokWebSource
83+
{
84+
AllowedWebsites =
85+
[
86+
"https://catedralaltapatagonia.com",
87+
"https://catedralaltapatagonia.com/parte-de-nieve/",
88+
"https://catedralaltapatagonia.com/tarifas/"
89+
]
90+
},
91+
]
92+
}]
93+
};
94+
```
95+
96+
> [!TIP]
97+
> You can configure multiple sources including `GrokWebSource`, `GrokNewsSource`,
98+
> `GrokRssSource` and `GrokXSource`, each containing granular options.
99+
65100
## OpenAI
66101

67102
The support for OpenAI chat clients provided in [Microsoft.Extensions.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI) fall short in some scenarios:

0 commit comments

Comments
 (0)