WebSearchConfig class

Unified web search configuration

This class provides a provider-agnostic way to configure web search functionality. Different providers will interpret these settings according to their specific API requirements.

Constructors

WebSearchConfig.new({int? maxUses, int? maxResults, List<String>? allowedDomains, List<String>? blockedDomains, WebSearchLocation? location, String? mode, String? fromDate, String? toDate, WebSearchType? searchType, WebSearchContextSize? contextSize, String? searchPrompt, WebSearchStrategy strategy = WebSearchStrategy.auto, bool enabled = true})
const
WebSearchConfig.anthropic({int maxUses = 5, List<String>? allowedDomains, List<String>? blockedDomains, WebSearchLocation? location})
Create an Anthropic-optimized configuration
factory
WebSearchConfig.basic({int maxResults = 5, List<String>? blockedDomains})
Create a basic web search configuration
factory
WebSearchConfig.openai({WebSearchContextSize contextSize = WebSearchContextSize.medium, WebSearchStrategy strategy = WebSearchStrategy.auto})
Create an OpenAI-optimized configuration
factory
WebSearchConfig.openRouter({int maxResults = 5, String? searchPrompt, bool useOnlineShortcut = true})
Create an OpenRouter-optimized configuration
factory
WebSearchConfig.perplexity({WebSearchContextSize contextSize = WebSearchContextSize.medium})
Create a Perplexity-optimized configuration
factory
WebSearchConfig.xai({int maxResults = 5, List<String>? blockedDomains, String mode = 'auto', String? fromDate, String? toDate, WebSearchType searchType = WebSearchType.web})
Create an xAI-optimized configuration
factory
WebSearchConfig.news({int maxResults = 10, String? fromDate, String? toDate})
Create a news search configuration
factory

Properties

allowedDomains List<String>?
List of allowed domains (whitelist)
final
blockedDomains List<String>?
List of blocked domains (blacklist)
final
contextSize WebSearchContextSize?
Search context size for providers that support it
final
enabled bool
Whether web search is enabled
final
fromDate String?
Start date for search results (YYYY-MM-DD format)
final
hashCode int
The hash code for this object.
no setterinherited
location WebSearchLocation?
Geographic location for search localization
final
maxResults int?
Maximum number of search results to return
final
maxUses int?
Maximum number of search operations per request
final
mode String?
Search mode/strategy
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchPrompt String?
Custom search prompt for result integration
final
searchType WebSearchType?
Type of search (web, news, etc.)
final
strategy WebSearchStrategy
Web search implementation strategy
final
toDate String?
End date for search results (YYYY-MM-DD format)
final

Methods

copyWith({int? maxUses, int? maxResults, List<String>? allowedDomains, List<String>? blockedDomains, WebSearchLocation? location, String? mode, String? fromDate, String? toDate, WebSearchType? searchType, WebSearchContextSize? contextSize, String? searchPrompt, WebSearchStrategy? strategy, bool? enabled}) WebSearchConfig
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited