Metadata-Version: 2.5
Name: polias-haystack
Version: 0.1.0
Summary: Haystack integration for Polias search: web, news, official sources and law
Project-URL: Homepage, https://api.polias.eu/
Project-URL: Source, https://github.com/Polias-Team/polias-haystack
Author-email: Polias <hallo@polias.eu>
License-Expression: MIT
License-File: LICENSE
Keywords: Haystack,Legal,Polias,Web Search
Requires-Python: >=3.10
Requires-Dist: haystack-ai>=2.12.0
Description-Content-Type: text/markdown

# polias-haystack

This package connects Haystack to [Polias](https://api.polias.eu/), a search engine with its own index, hosted in the EU.
Use it in RAG pipelines or with Haystack Agents to search the web, news, official sources and law.

## Installation

```bash
pip install polias-haystack
```

You need a Polias API key. Create an account at [api.polias.eu/account](https://api.polias.eu/account), as a company or as a
private person (private accounts: residents of Germany, Austria or Switzerland, 18 or older, non-commercial use only).
Each month, 1,000 searches are free for companies and 100 for private persons. More is available as packages, see
[pricing](https://api.polias.eu/pricing).

```bash
export POLIAS_API_KEY="pol_..."
```

## Usage

### PoliasWebSearch

```python
from haystack_integrations.components.websearch.polias import PoliasWebSearch

websearch = PoliasWebSearch(top_k=5, areas=["web", "legal"])
result = websearch.run(query="Kündigung Eigenbedarf")
documents = result["documents"]  # snippet as content; title, link, area in meta
links = result["links"]
```

The areas are:
- `web`;
- `news`: articles from the last 30 days;
- `legal`: court decisions and legislation;
- `official`: websites of public authorities in Germany, Austria, Switzerland and the EU. Use it without `web`.

### PoliasAISearch

This component returns documents for AI answers. Each document has licence details. Where the licence allows, it holds a
longer excerpt, and for legal results the full text.

```python
from haystack_integrations.components.websearch.polias import PoliasAISearch

search = PoliasAISearch(top_k=3, areas=["web", "legal"])
documents = search.run(query="Mietminderung Schimmel")["documents"]
```

Please show the source notice (`meta["notice"]`) with legal results.

### Options

- `lang`: `"de"` (the default) or `"en"`. English focuses on technical topics such as developer documentation, software
  and IT.
- `country`: `"de"`, `"at"` or `"ch"`, to prefer results from that country.
- `api_key`: a `Secret`. It defaults to the environment variable `POLIAS_API_KEY`.

Both components support `run_async`.

## License

MIT. Documentation: [api.polias.eu](https://api.polias.eu/) · Questions: hallo@polias.eu
