SerpApiToolkit enable an Assistant to search Google and YouTube for a query.

Example

The following assistant will search Google for the query: “Whats happening in the USA” and share results.

cookbook/tools/serpapi_tools.py
from phi.assistant import Assistant
from phi.tools.serpapi_tools import SerpApiTools

assistant = Assistant(
    tools=[SerpApiTools()],
    show_tool_calls=True,
    debug_mode=True,
)

assistant.print_response("Whats happening in the USA?", markdown=True)

Toolkit Params

api_key
str

API key for authentication purposes.

search_youtube
bool
default: "False"

Enables the functionality to search for content on YouTube.

Toolkit Functions

search_google

This function searches Google for a query.

search_youtube

Searches YouTube for a query.