Google Search Integration
What the integration does
Google Search integration allows users to perform web searches directly using Google's search engine, providing easy access to search results from within an application. This can be particularly useful for tasks such as looking up information, finding websites, or accessing recent news articles.
Short description
- Purpose: To provide a seamless way for applications to access Google search results within their own interface.
- Typical use cases: Research, information retrieval, content discovery.
Example scenarios
- A chatbot searching for the latest news articles related to a user's query and presenting the results.
- An application needing to perform a quick lookup of available information on a topic requested by a user.
Capabilities
What the integration enables
- Search Google for a specified query.
Input/Output schemas for each capability
- Google Search
- Input:
- query (str): The query to search for.
- max_results (int, optional): The maximum number of results to return. Default is 5.
- language (str, optional): The language of the search results. Default is "en".
- Output:
- JSON formatted string containing search results with fields:
- title (str): Title of the result.
- url (str): URL of the result.
- description (str): Description of the result.
- JSON formatted string containing search results with fields:
- Input:
Limitations
- Rate limits: Not specified within the integration documentation.
- Partial API coverage: Depends on the data and formatting available from Google's search engine.
Setup & Configuration
Prerequisites
- Install googlesearch-python library using pip: pip install googlesearch-python.
- Optional: pycountry package for language code conversion.
Authentication
- There are no specific authentication requirements as it uses web scraping (not official Google API).
Step-by-step guide
- Install the necessary Python packages:
bash pip install googlesearch-python pip install pycountry
- Import the required modules in your Python script, including the GoogleSearchTools class.
Testing connection
- Use the google_search method with a test query to ensure search results are returned correctly.
How to Use in Agents
Example prompts
- "Search for the latest news on climate change."
- "Find popular programming tutorials."
Code/configuration snippet for enabling an integration in an agent definition
python
Initialize the Googler search tool
search_tool = GoogleSearchTools(fixed_max_results=10)
Perform a search
results = search_tool.google_search("Artificial Intelligence", 5) print(results)
Best practices
- Use caching to improve performance and avoid repeated searches for the same query.
- Check and adhere to Google's terms of service when using web scrapers.
Reference Section
Links to the original service's API docs
- goooglesearch-python GitHub for deeper detail on implementation.