GoogleSearch Class
A search engine connector that uses the Google Search API to perform a web search.
Note: This class is marked as 'experimental' and may change in the future.
Initializes a new instance of the Google Search class.
Constructor
GoogleSearch(api_key: str | None = None, search_engine_id: str | None = None, env_file_path: str | None = None, env_file_encoding: str | None = None)
Parameters
| Name | Description |
|---|---|
|
api_key
|
The Google Search API key. If provided, will override the value in the env vars or .env file. Default value: None
|
|
search_engine_id
|
The Google search engine ID. If provided, will override the value in the env vars or .env file. Default value: None
|
|
env_file_path
|
The optional path to the .env file. If provided, the settings are read from this file path location. Default value: None
|
|
env_file_encoding
|
The optional encoding of the .env file. Default value: None
|
Methods
| get_search_results |
Search for text, returning a KernelSearchResult with the results directly from the service. |
| get_text_search_results |
Search for text, returning a KernelSearchResult with TextSearchResults. |
| search |
Search for text, returning a KernelSearchResult with a list of strings. |
get_search_results
Search for text, returning a KernelSearchResult with the results directly from the service.
async get_search_results(query: str, options: SearchOptions | None = None, **kwargs) -> KernelSearchResults[GoogleSearchResult]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
|
|
options
|
Default value: None
|
get_text_search_results
Search for text, returning a KernelSearchResult with TextSearchResults.
async get_text_search_results(query: str, options: SearchOptions | None = None, **kwargs) -> KernelSearchResults[TextSearchResult]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
|
|
options
|
Default value: None
|
search
Search for text, returning a KernelSearchResult with a list of strings.
async search(query: str, options: SearchOptions | None = None, **kwargs: Any) -> KernelSearchResults[str]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
|
|
options
|
Default value: None
|
Attributes
is_experimental
is_experimental = True
settings
settings: GoogleSearchSettings
stage_status
stage_status = 'experimental'