Web Search Drivers
Overview
Web Search Drivers can be used to search for links from a search query. They are used by WebSearch to provide its functionality. All Web Search Drivers implement the following methods:
search()
searches the web and returns a ListArtifact that contains JSON-serializable TextArtifacts with the search results.
You can use Web Search Drivers with Structures:
from griptape.drivers import DuckDuckGoWebSearchDriver
from griptape.structures import Agent
from griptape.tools import PromptSummaryTool, WebSearchTool
agent = Agent(
tools=[WebSearchTool(web_search_driver=DuckDuckGoWebSearchDriver()), PromptSummaryTool(off_prompt=False)],
)
agent.run("Give me some websites with information about AI frameworks.")
ToolkitTask 45a53f1024494baab41a1f10a67017b1
Output: Here are some websites with information about AI
frameworks:
1. [The Top 16 AI Frameworks and Libraries: A Beginner's Guide -
DataCamp](https://www.datacamp.com/blog/top-ai-frameworks-and-lib
raries)
2. [AI Frameworks: Top Types To Adopt in 2024 -
Splunk](https://www.splunk.com/en_us/blog/learn/ai-frameworks.htm
l)
3. [Top AI Frameworks in 2024: A Review -
BairesDev](https://www.bairesdev.com/blog/ai-frameworks/)
4. [The Top 16 AI Frameworks and Libraries - AI
Slackers](https://aislackers.com/the-top-16-ai-frameworks-and-lib
raries/)
5. [Top AI Frameworks in 2024: Artificial Intelligence Frameworks
Comparison - Clockwise
Software](https://clockwise.software/blog/artificial-intelligence
-framework/)
from griptape.drivers import DuckDuckGoWebSearchDriver
driver = DuckDuckGoWebSearchDriver()
driver.search("griptape ai")
{"title": "The Top 16 AI Frameworks and Libraries: A Beginner's Guide", "url": "https://www.datacamp.com/blog/top-ai-frameworks-and-libraries", "description": "PyTorch. Torch is an open-source machine learning library known for its dynamic computational graph and is favored by researchers. The framework is excellent for prototyping and experimentation. Moreover, it's empowered by growing community support, with tools like PyTorch being built on the library."}
{"title": "Top 11 AI Frameworks and Tools in 2024 | Fively | 5ly.co", "url": "https://5ly.co/blog/best-ai-frameworks/", "description": "Discover the top 11 modern artificial intelligence tools and frameworks to build robust architectures for your AI-powered apps. ... - Some advanced use cases may need further fine-tuning. Caffe 2. Now we move on to deep learning tools and frameworks. The first one is Caffe 2: an open-source deep learning framework with modularity and speed in ..."}
{"title": "The Top 16 AI Frameworks and Libraries | AI Slackers", "url": "https://aislackers.com/the-top-16-ai-frameworks-and-libraries/", "description": "Experiment with different frameworks to find the one that aligns with your needs and goals as a data practitioner. Embrace the world of AI frameworks, and embark on a journey of building smarter software with confidence. Discover the top AI frameworks and libraries like PyTorch, Scikit-Learn, TensorFlow, Keras, LangChain, and more."}
Web Search Drivers
The GoogleWebSearchDriver uses the Google Custom Search JSON API for web searching.
Example using GoogleWebSearchDriver
directly:
import os
from griptape.drivers import GoogleWebSearchDriver
driver = GoogleWebSearchDriver(
api_key=os.environ["GOOGLE_API_KEY"],
search_id=os.environ["GOOGLE_API_SEARCH_ID"],
)
driver.search("griptape ai")
DuckDuckGo
Info
This driver requires the drivers-web-search-duckduckgo
extra.
The DuckDuckGoWebSearchDriver uses the duckduckgo_search SDK for web searching.
Example of using DuckDuckGoWebSearchDriver
directly:
from griptape.drivers import DuckDuckGoWebSearchDriver
driver = DuckDuckGoWebSearchDriver()
driver.search("griptape ai")
Tavily
Example of using TavilyWebSearchDriver
directly:
import os
from griptape.drivers import TavilyWebSearchDriver
driver = TavilyWebSearchDriver(api_key=os.environ["TAVILY_API_KEY"])
driver.search("griptape ai")
Exa
Example of using ExaWebSearchDriver
directly: