Metadata-Version: 2.5
Name: langchain-polias
Version: 0.1.1
Summary: An integration package connecting Polias search and LangChain
Project-URL: Homepage, https://api.polias.eu/
Project-URL: Source Code, https://github.com/Polias-Team/langchain-polias
Author-email: Polias <hallo@polias.eu>
License-Expression: MIT
License-File: LICENSE
Keywords: langchain,legal,polias,search,web search
Requires-Python: <4.0,>=3.10
Requires-Dist: langchain-core<2.0,>=0.3.70
Requires-Dist: requests>=2.31.0
Description-Content-Type: text/markdown

# langchain-polias

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

## Installation

```bash
pip install -U langchain-polias
```

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_..."
```

## Tools

```python
from langchain_polias import PoliasAISearch, PoliasLegalSearch, PoliasSearch

search = PoliasSearch()
search.invoke({"query": "Kündigung Eigenbedarf", "areas": ["web", "legal"], "count": 5})
```

- `PoliasSearch` returns results with title, URL and a short snippet. The areas are `web`, `news` (last 30 days),
  `legal` (court decisions and legislation) and `official` (websites of public authorities in Germany, Austria,
  Switzerland and the EU). The optional `town` field focuses local results, e.g. `"Köln"`. With `web` and other
  areas, the results are shared: each other area gets `count` divided by the number of areas (rounded down), web gets
  the rest. The example above gives 3 web and 2 legal results.
- `PoliasAISearch` returns results for AI answers. Each result carries licence details and, where the licence allows,
  a longer excerpt. For `legal` results, the full text is included where the licence allows it.
- `PoliasLegalSearch` searches court decisions and legislation from the EU and European countries. It returns court,
  case number, date, ECLI and source. Please show the source notice (`notice`) with the result.

With an agent:

```python
from langchain.agents import create_agent

agent = create_agent(model, tools=[PoliasSearch(), PoliasLegalSearch()])  # any chat model with tool calling
```

## Retriever

```python
from langchain_polias import PoliasRetriever

retriever = PoliasRetriever(k=3, areas=["web", "legal"])
docs = retriever.invoke("Mietminderung Schimmel")
```

## Options

All classes take these 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`: use this instead of the environment variable.

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