Metadata-Version: 2.1
Name: haystack-duckduckgo
Version: 0.0.1
Project-URL: Documentation, https://github.com/LLukas22/haystack-duckduckgo#readme
Project-URL: Issues, https://github.com/LLukas22/haystack-duckduckgo/issues
Project-URL: Source, https://github.com/LLukas22/haystack-duckduckgo
Author-email: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
Requires-Dist: duckduckgo-search>=3.8.2
Requires-Dist: farm-haystack>=1.17.0
Description-Content-Type: text/markdown

# haystack-duckduckgo

[![PyPI - Version](https://img.shields.io/pypi/v/haystack-duckduckgo.svg)](https://pypi.org/project/haystack-duckduckgo)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/haystack-duckduckgo.svg)](https://pypi.org/project/haystack-duckduckgo)

Use the [DuckDuckGo](https://duckduckgo.com/) search engine with your haystack pipeline or agents.
-----

**Table of Contents**

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## Installation

```console
pip install haystack-duckduckgo
```
## Usage
This package allows you to use the [DuckDuckGo](https://duckduckgo.com/) search api, which does not require an API key and can be used free of charge.

Use it in Haystacks [WebSearch](https://docs.haystack.deepset.ai/docs/search_engine#websearch) component:
```python
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](https://docs.haystack.deepset.ai/reference/retriever-api#webretriever)

```python
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](https://spdx.org/licenses/MIT.html) license.
