Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/oss/python/integrations/providers/all_providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3012,4 +3012,12 @@ title: "All providers"
cta="View provider guide"
/>

<Card

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this in alphabetical order

title="Perigon"
icon="link"
href="/oss/integrations/providers/perigon_search"
arrow="true"
cta="View provider guide"
/>

</Columns>
1 change: 1 addition & 0 deletions src/oss/python/integrations/providers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ These providers have standalone `langchain-{provider}` packages for improved ver
| [MCP Toolbox](/oss/integrations/providers/toolbox-langchain/) | [toolbox-langchain](https://pypi.org/project/toolbox-langchain/) | ![Downloads](https://static.pepy.tech/badge/toolbox-langchain/month) | ![PyPI - Version](https://img.shields.io/pypi/v/toolbox-langchain?style=flat-square&label=%20&color=orange) | ❌ |
| [Scrapeless](/oss/integrations/providers/scrapeless/) | [langchain-scrapeless](https://pypi.org/project/langchain-scrapeless/) | ![Downloads](https://static.pepy.tech/badge/langchain-scrapeless/month) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-scrapeless?style=flat-square&label=%20&color=orange) | ❌ |
| [ZeusDB](/oss/integrations/providers/zeusdb/) | [langchain-zeusdb](https://pypi.org/project/langchain-zeusdb/) | ![Downloads](https://static.pepy.tech/badge/langchain-zeusdb/month) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-zeusdb?style=flat-square&label=%20&color=orange) | ❌ |
| [Perigon](/oss/integrations/providers/perigon_search/) | [langchain-perigon](https://pypi.org/project/langchain-perigon/) | ![Downloads](https://static.pepy.tech/badge/langchain-perigon/month) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-perigon?style=flat-square&label=%20&color=orange) | ❌ |

## All Providers

Expand Down
80 changes: 80 additions & 0 deletions src/oss/python/integrations/providers/perigon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Perigon
---

>[Perigon](https://perigon.io/) is a comprehensive news API that provides access to real-time contextual information in news articles, stories, metadata and wikipedia pages from thousands of sources worldwide.
>

## Installation and Setup

`Perigon` integration exists in its own [partner package](https://pypi.org/project/langchain-perigon/). You can install it with:

```python
%pip install -qU langchain-perigon
```

In order to use the package, you will also need to set the `PERIGON_API_KEY` environment variable to your Perigon API key.

## Retrievers

Perigon provides two retrievers:

### ArticlesRetriever

This retriever retrieves articles based on a given query and optional filters.

See a [full usage example](/oss/integrations/retrievers/perigon#using-articlesretriever).

```python
# Make sure PERIGON_API_KEY environment variable is set to your Perigon API key
from langchain_perigon import ArticlesRetriever, ArticlesFilter

# Create retriever with specific number of results
retriever = ArticlesRetriever(k=12)

# Configure filter options to exclude reprints and focus on US articles
options: ArticlesFilter = {
"showReprints": False, # Exclude duplicate/reprint articles
"filter": {"country": "us"}, # Only US-based news
}

try:
documents = retriever.invoke("Recent big tech layoffs", options=options)

# Check if we got results before accessing
if documents:
print(f"First document: {documents[0].page_content[:200]}...")
else:
print("No articles found for the given query.")
except Exception as e:
print(f"Error retrieving articles: {e}")
```

You can use the `ArticlesRetriever` in a standard retrieval pipeline:

### WikipediaRetriever

This retriever retrieves wikipedia pages based on a given query and optional filters.

See a [full usage example](/oss/integrations/retrievers/perigon#using-wikipediaretriever).

```python
# Make sure PERIGON_API_KEY environment variable is set to your Perigon API key
from langchain_perigon import WikipediaRetriever

# Create retriever with specific number of results
retriever = WikipediaRetriever(k=12)

try:
documents = retriever.invoke("machine learning")

# Safely access results with error handling
if documents:
print(f"First document: {documents[0].page_content[:200]}...")
else:
print("No Wikipedia articles found for the given query.")
except Exception as e:
print(f"Error retrieving Wikipedia articles: {e}")
```

You can use the `WikipediaRetriever` in a standard retrieval pipeline:
Loading
Loading