Skip to content

Commit 889a238

Browse files
authored
Perigon integration (#627)
## Overview <!-- Brief description of what documentation is being added/updated --> Add the documentation for the new [perigon-langchain](https://github.com/goperigon/langchain-perigon) integration. The Perigon API suite provides fast, structured access to global news and events, helping you build real-time, data-driven products. Whether you're tracking emerging risks, surfacing relevant articles, or uncovering key insights, Perigon gives you the tools to do it programmatically. ## Type of change **Type:** New documentation page ## Related issues/PRs <!-- Link to related issues, feature PRs, or discussions (if applicable) To automatically close an issue when this PR is merged, use closing keywords: - "closes #123" or "fixes #123" or "resolves #123" For regular references without auto-closing, just use: - "#123" or "See issue #123" Examples: - closes #456 (will auto-close issue #456 when PR is merged) - See #789 for context (will reference but not auto-close issue #789) --> - GitHub issue: - Feature PR: <!-- For LangChain employees, if applicable: --> - Linear issue: - Slack thread: ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers --> You can learn more about Perigon from the following links: 1. Perigon workspace: https://perigon.io 2. Perigon for developers: https://dev.perigon.io
1 parent a163054 commit 889a238

File tree

4 files changed

+414
-0
lines changed

4 files changed

+414
-0
lines changed

src/oss/python/integrations/providers/all_providers.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,14 @@ title: "All providers"
20832083
cta="View provider guide"
20842084
/>
20852085

2086+
<Card
2087+
title="Perigon"
2088+
icon="link"
2089+
href="/oss/integrations/providers/perigon_search"
2090+
arrow="true"
2091+
cta="View provider guide"
2092+
/>
2093+
20862094
<Card
20872095
title="Perplexity"
20882096
icon="link"

src/oss/python/integrations/providers/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ These providers have standalone `langchain-{provider}` packages for improved ver
136136
| [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) ||
137137
| [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) ||
138138
| [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) ||
139+
| [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) ||
139140

140141
## All Providers
141142

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Perigon
3+
---
4+
5+
>[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.
6+
>
7+
8+
## Installation and Setup
9+
10+
`Perigon` integration exists in its own [partner package](https://pypi.org/project/langchain-perigon/). You can install it with:
11+
12+
```python
13+
%pip install -qU langchain-perigon
14+
```
15+
16+
In order to use the package, you will also need to set the `PERIGON_API_KEY` environment variable to your Perigon API key.
17+
18+
## Retrievers
19+
20+
Perigon provides two retrievers:
21+
22+
### ArticlesRetriever
23+
24+
This retriever retrieves articles based on a given query and optional filters.
25+
26+
See a [full usage example](/oss/integrations/retrievers/perigon#using-articlesretriever).
27+
28+
```python
29+
# Make sure PERIGON_API_KEY environment variable is set to your Perigon API key
30+
from langchain_perigon import ArticlesRetriever, ArticlesFilter
31+
32+
# Create retriever with specific number of results
33+
retriever = ArticlesRetriever(k=12)
34+
35+
# Configure filter options to exclude reprints and focus on US articles
36+
options: ArticlesFilter = {
37+
"showReprints": False, # Exclude duplicate/reprint articles
38+
"filter": {"country": "us"}, # Only US-based news
39+
}
40+
41+
try:
42+
documents = retriever.invoke("Recent big tech layoffs", options=options)
43+
44+
# Check if we got results before accessing
45+
if documents:
46+
print(f"First document: {documents[0].page_content[:200]}...")
47+
else:
48+
print("No articles found for the given query.")
49+
except Exception as e:
50+
print(f"Error retrieving articles: {e}")
51+
```
52+
53+
You can use the `ArticlesRetriever` in a standard retrieval pipeline:
54+
55+
### WikipediaRetriever
56+
57+
This retriever retrieves wikipedia pages based on a given query and optional filters.
58+
59+
See a [full usage example](/oss/integrations/retrievers/perigon#using-wikipediaretriever).
60+
61+
```python
62+
# Make sure PERIGON_API_KEY environment variable is set to your Perigon API key
63+
from langchain_perigon import WikipediaRetriever
64+
65+
# Create retriever with specific number of results
66+
retriever = WikipediaRetriever(k=12)
67+
68+
try:
69+
documents = retriever.invoke("machine learning")
70+
71+
# Safely access results with error handling
72+
if documents:
73+
print(f"First document: {documents[0].page_content[:200]}...")
74+
else:
75+
print("No Wikipedia articles found for the given query.")
76+
except Exception as e:
77+
print(f"Error retrieving Wikipedia articles: {e}")
78+
```
79+
80+
You can use the `WikipediaRetriever` in a standard retrieval pipeline:

0 commit comments

Comments
 (0)