advancedWebSearch method
LLMBuilder
advancedWebSearch({
- WebSearchStrategy? strategy,
- WebSearchContextSize? contextSize,
- String? searchPrompt,
- int? maxUses,
- int? maxResults,
- List<
String> ? allowedDomains, - List<
String> ? blockedDomains, - WebSearchLocation? location,
- String? mode,
- String? fromDate,
- String? toDate,
- WebSearchType? searchType,
Advanced web search configuration with full control
This method provides access to all web search parameters and allows fine-grained control over the search behavior across all providers.
Example:
final provider = await ai()
.anthropic()
.apiKey(apiKey)
.advancedWebSearch(
strategy: WebSearchStrategy.tool,
contextSize: WebSearchContextSize.high,
searchPrompt: 'Focus on academic sources',
maxUses: 3,
allowedDomains: ['arxiv.org', 'scholar.google.com'],
)
.build();
Implementation
LLMBuilder advancedWebSearch({
WebSearchStrategy? strategy,
WebSearchContextSize? contextSize,
String? searchPrompt,
int? maxUses,
int? maxResults,
List<String>? allowedDomains,
List<String>? blockedDomains,
WebSearchLocation? location,
String? mode,
String? fromDate,
String? toDate,
WebSearchType? searchType,
}) {
final config = WebSearchConfig(
strategy: strategy ?? WebSearchStrategy.auto,
contextSize: contextSize,
searchPrompt: searchPrompt,
maxUses: maxUses,
maxResults: maxResults,
allowedDomains: allowedDomains,
blockedDomains: blockedDomains,
location: location,
mode: mode,
fromDate: fromDate,
toDate: toDate,
searchType: searchType,
);
return extension('webSearchConfig', config);
}