class WebSearch extends ProviderTool

Properties

protected array<string, mixed>|SerializableClosure $providerOptions from  ProviderTool
string|null $city
string|null $region
string|null $country

Methods

withProviderOptions(array|Closure $options)

Attach provider-specific options to the tool payload. Closures may only capture serializable values.

array
providerOptions(Lab|string $provider)

Get the provider-specific options for the given provider.

__construct(int|null $maxSearches = null, array $allowedDomains = [])

Create a web search tool with optional search limits and allowed domains.

max(int $max)

Set the maximum number of searches.

allow(array $domains)

Set the allowed domains.

location(string|null $city = null, string|null $region = null, string|null $country = null)

Set the user's location to refine search results based on the given location.

bool
hasLocation()

Determine if the web search uses the user's location.

Details

in ProviderTool at line 23
ProviderTool withProviderOptions(array|Closure $options)

Attach provider-specific options to the tool payload. Closures may only capture serializable values.

Parameters

array|Closure $options

Return Value

ProviderTool

in ProviderTool at line 37
array providerOptions(Lab|string $provider)

Get the provider-specific options for the given provider.

Parameters

Lab|string $provider

Return Value

array

at line 18
__construct(int|null $maxSearches = null, array $allowedDomains = [])

Create a web search tool with optional search limits and allowed domains.

Parameters

int|null $maxSearches
array $allowedDomains

at line 27
WebSearch max(int $max)

Set the maximum number of searches.

Parameters

int $max

Return Value

WebSearch

at line 37
WebSearch allow(array $domains)

Set the allowed domains.

Parameters

array $domains

Return Value

WebSearch

at line 47
WebSearch location(string|null $city = null, string|null $region = null, string|null $country = null)

Set the user's location to refine search results based on the given location.

Parameters

string|null $city
string|null $region
string|null $country

Return Value

WebSearch

at line 59
bool hasLocation()

Determine if the web search uses the user's location.

Return Value

bool