newsSearch method
Enables news search functionality
Configures the provider to search news sources specifically. This is particularly useful for current events and recent information.
Example:
final provider = await ai()
.xai()
.apiKey(apiKey)
.newsSearch(
maxResults: 10,
fromDate: '2024-01-01',
)
.build();
Implementation
LLMBuilder newsSearch({
int? maxResults,
String? fromDate,
String? toDate,
List<String>? blockedDomains,
}) {
final config = WebSearchConfig(
maxResults: maxResults,
fromDate: fromDate,
toDate: toDate,
blockedDomains: blockedDomains,
mode: 'auto',
searchType: WebSearchType.news,
);
return extension('webSearchConfig', config);
}