Skip to main content
Ctrl+K
Gen AI Builder SDK 1.3 documentation - Home
  • Data abstractions
    • Artifacts
    • Chunkers
    • Loaders
  • Prompt
    • Assistant
    • Audio Transcription
    • Conversation Memory
    • Embedding
    • Event Listener
    • File Manager
    • Image Generation
    • Observability
    • Rerank
    • Ruleset
    • SQL
    • Structure Run
    • Text to Speech
    • Vector Store
    • Web Scraper
    • Web Search
  • RAG Engine
    • Eval Engine
    • Extraction Engines
    • Summary Engine
  • Events
    • Serialization
    • Tokenizers
  • SDK reference
    • artifacts
      • action_artifact
      • audio_artifact
      • base_artifact
      • blob_artifact
      • boolean_artifact
      • error_artifact
      • generic_artifact
      • image_artifact
      • image_url_artifact
      • info_artifact
      • json_artifact
      • list_artifact
      • model_artifact
      • text_artifact
      • url_artifact
    • chunkers
      • base_chunker
      • chunk_separator
      • markdown_chunker
      • pdf_chunker
      • text_chunker
    • common
    • configs
      • base_config
      • defaults_config
      • drivers
        • amazon_bedrock_drivers_config
        • anthropic_drivers_config
        • azure_openai_drivers_config
        • base_drivers_config
        • cohere_drivers_config
        • drivers_config
        • google_drivers_config
        • openai_drivers_config
      • logging
        • json_formatter
        • logging_config
        • newline_logging_filter
        • truncate_logging_filter
    • drivers
    • engines
      • eval
        • base_eval_engine
        • eval_engine
      • extraction
        • base_extraction_engine
        • csv_extraction_engine
        • json_extraction_engine
      • rag
        • modules
        • rag_context
        • rag_engine
        • stages
      • summary
        • base_summary_engine
        • prompt_summary_engine
    • events
      • action_chunk_event
      • audio_chunk_event
      • base_actions_subtask_event
      • base_audio_transcription_event
      • base_chunk_event
      • base_event
      • base_image_generation_event
      • base_image_query_event
      • base_media_generation_event
      • base_prompt_event
      • base_task_event
      • base_text_to_speech_event
      • event_bus
      • event_listener
      • finish_actions_subtask_event
      • finish_audio_transcription_event
      • finish_image_generation_event
      • finish_image_query_event
      • finish_prompt_event
      • finish_structure_run_event
      • finish_task_event
      • finish_text_to_speech_event
      • start_actions_subtask_event
      • start_audio_transcription_event
      • start_image_generation_event
      • start_image_query_event
      • start_prompt_event
      • start_structure_run_event
      • start_task_event
      • start_text_to_speech_event
      • text_chunk_event
    • exceptions
      • dummy_exception
    • loaders
      • audio_loader
      • base_file_loader
      • base_loader
      • blob_loader
      • csv_loader
      • email_loader
      • image_loader
      • json_loader
      • pdf_loader
      • sql_loader
      • text_loader
      • web_loader
    • memory
      • meta
        • action_subtask_meta_entry
        • base_meta_entry
        • meta_memory
      • structure
        • base_conversation_memory
        • conversation_memory
        • run
        • summary_conversation_memory
      • task
        • storage
        • task_memory
    • mixins
      • actions_subtask_origin_mixin
      • activity_mixin
      • artifact_file_output_mixin
      • exponential_backoff_mixin
      • futures_executor_mixin
      • rule_mixin
      • runnable_mixin
      • serializable_mixin
      • singleton_mixin
    • observability
      • observability
    • rules
      • base_rule
      • json_schema_rule
      • rule
      • ruleset
    • schemas
      • base_schema
      • bytes_field
      • polymorphic_schema
      • pydantic_model_field
      • union_field
    • structures
      • agent
      • pipeline
      • structure
      • workflow
    • tasks
      • actions_subtask
      • assistant_task
      • audio_transcription_task
      • base_audio_generation_task
      • base_audio_input_task
      • base_image_generation_task
      • base_subtask
      • base_task
      • base_text_input_task
      • branch_task
      • code_execution_task
      • extraction_task
      • inpainting_image_generation_task
      • outpainting_image_generation_task
      • output_schema_validation_subtask
      • prompt_image_generation_task
      • prompt_task
      • rag_task
      • structure_run_task
      • text_summary_task
      • text_to_speech_task
      • tool_task
      • toolkit_task
      • variation_image_generation_task
    • tokenizers
      • amazon_bedrock_tokenizer
      • anthropic_tokenizer
      • base_tokenizer
      • cohere_tokenizer
      • dummy_tokenizer
      • google_tokenizer
      • grok_tokenizer
      • huggingface_tokenizer
      • openai_tokenizer
      • simple_tokenizer
      • voyageai_tokenizer
    • tools
      • audio_transcription
        • tool
      • base_griptape_cloud_tool
      • base_image_generation_tool
      • base_tool
      • calculator
        • tool
      • computer
        • tool
      • date_time
        • tool
      • email
        • tool
      • extraction
        • tool
      • file_manager
        • tool
      • griptape_cloud_tool
        • tool
      • image_query
        • tool
      • inpainting_image_generation
        • tool
      • outpainting_image_generation
        • tool
      • prompt_image_generation
        • tool
      • prompt_summary
        • tool
      • query
        • tool
      • rag
        • tool
      • rest_api
        • tool
      • sql
        • tool
      • structure_run
        • tool
      • structured_output
        • tool
      • text_to_speech
        • tool
      • variation_image_generation
        • tool
      • vector_store
        • tool
      • web_scraper
        • tool
      • web_search
        • tool
    • utils
      • chat
      • command_runner
      • constants
      • contextvars_utils
      • conversation
      • decorators
      • deprecation
      • dict_utils
      • file_utils
      • futures
      • griptape_cloud
      • hash
      • import_utils
      • j2
      • json_schema_utils
      • load_artifact_from_memory
      • manifest_validator
      • paths
      • python_runner
      • reference_utils
      • stream
      • structure_visualizer
      • token_counter
  • Agents
    • Configs
    • Conversation Memory
    • Observability
    • Pipelines
    • Rulesets
    • Task Memory and Off Prompt
    • Tasks
    • Workflows
  • Tools in Gen AI Builder
    • Custom Tools
    • Official Tools
  • .rst

Web Search

Contents

  • Overview
  • Web Search Drivers
    • Google
    • DuckDuckGo
    • Tavily
    • Exa
    • Perplexity

Web Search#

Overview#

Web Search Drivers can be used to search for links from a search query. They are used by BaseWebSearchDriver to provide its functionality. All Web Search Drivers implement the following methods:

  • search() searches the web and returns a ListArtifact that contains JSON-serializable TextArtifact s with the search results.

You can use Web Search Drivers with Structures :

from griptape.drivers.web_search.duck_duck_go 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.")
PromptTask 45a53f1024494baab41a1f10a67017b1
    Output: Here are some websites with information about AI
    frameworks:

      1. [The Top 16 AI Frameworks and Libraries: A Beginners 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/)

Or use them independently:

from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver

driver = DuckDuckGoWebSearchDriver()

driver.search("griptape ai")
{"title": "The Top 16 AI Frameworks and Libraries: A Beginners 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, its 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#

Google#

The GoogleWebSearchDriver uses the Google Custom Search JSON API for web searching.

import os

from griptape.drivers.web_search.google import GoogleWebSearchDriver

driver = GoogleWebSearchDriver(
    api_key=os.environ["GOOGLE_API_KEY"],
    search_id=os.environ["GOOGLE_API_SEARCH_ID"],
)

driver.search("griptape ai")

DuckDuckGo#

The DuckDuckGoWebSearchDriver uses the duckduckgo_search SDK for web searching.

from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver

driver = DuckDuckGoWebSearchDriver()

driver.search("griptape ai")

Tavily#

import os

from griptape.drivers.web_search.tavily import TavilyWebSearchDriver

driver = TavilyWebSearchDriver(api_key=os.environ["TAVILY_API_KEY"])

driver.search("griptape ai")

Exa#

import os

from griptape.drivers.web_search.exa import ExaWebSearchDriver

driver = ExaWebSearchDriver(api_key=os.environ["EXA_API_KEY"])

driver.search("griptape ai")

Perplexity#

The PerplexityWebSearchDriver uses the Perplexity Prompt Driver internally.

import os

from griptape.drivers.web_search.perplexity import PerplexityWebSearchDriver

driver = PerplexityWebSearchDriver(
    api_key=os.environ["PERPLEXITY_API_KEY"],
)
result = driver.search("griptape ai")

print(result.to_text())

#  The search results will only contain a single Artifact.

#  This Artifact contains the search results and any citations.

for citation in result[0].meta["citations"]:
    print(citation)

`

  1. Set up your OpenAI API key:

export OPENAI_API_KEY=your_api_key_here
  1. Create a Python file (e.g., app.py ) and import necessary modules from Griptape[3].

  2. Build your AI application using Griptape’s components such as agents, pipelines, and tools[3].

Griptape offers a powerful and flexible way to create AI-driven applications, from simple chatbots to complex multi-agent systems. Its modular approach allows developers to easily integrate custom tools and external resources, enhancing the capabilities of AI agents[3][4]. https://www.griptape.ai griptape-ai https://www.youtube.com/watch?v=AEcztigpnc0 https://www.youtube.com/watch?v=1FFeMZyWxJA griptape-ai/griptape https://www.youtube.com/@griptape-ai

````

previous

Web Scraper

next

RAG Engine

Contents
  • Overview
  • Web Search Drivers
    • Google
    • DuckDuckGo
    • Tavily
    • Exa
    • Perplexity

By EnterpriseDB Corporation

© Copyright EnterpriseDB Corporation.