Skip to main content

No project description provided

Project description

haystack-duckduckgo

PyPI - Version PyPI - Python Version

Use the DuckDuckGo search engine with your haystack pipeline or agents.

Table of Contents

Installation

pip install haystack-duckduckgo

Usage

This package allows you to use the DuckDuckGo search api, which does not require an API key and can be used free of charge.

Use it in Haystacks WebSearch component:

from haystack_duckduckgo import DuckDuckGoAPI
from haystack.nodes.search_engine import WebSearch

#Build the DuckDuckGo provider
search_engine_provider = DuckDuckGoAPI()
#Initialize the `WebSearch` node with the provider
ws = WebSearch(api_key=None,search_engine_provider=search_engine_provider)

#Use the `WebSearch` node
results = ws.run(query="python programming language")[0]
print(results)

Use it in a Haystack WebRetriever

from haystack_duckduckgo import DuckDuckGoAPI
from haystack.nodes.retriever.web import WebRetriever
from haystack import Pipeline

#Build the DuckDuckGo provider
search_engine_provider = DuckDuckGoAPI()

#Build the pipeline
wr = WebRetriever(api_key=None,search_engine_provider=search_engine_provider)
p=Pipeline()
p.add_node(wr,name="web_retriever",inputs=["Query"])

#Run the pipeline
results = p.run(query="python")
print(results)

License

haystack-duckduckgo is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haystack_duckduckgo-0.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

haystack_duckduckgo-0.0.1-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page