Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion pipeline/tools/partner_pkg_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

from pathlib import Path
from typing import Optional

import yaml

Expand Down Expand Up @@ -64,7 +65,7 @@ def _get_type(package: dict) -> str:
return "third-party"


def _enrich_package(p: dict) -> dict | None:
def _enrich_package(p: dict) -> Optional[dict]:
"""Enrich package metadata with additional fields.

Args:
Expand Down
11 changes: 11 additions & 0 deletions reference/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,14 @@ packages:
path: libs/voyageai
downloads: 30000
downloads_updated_at: "2025-10-27T00:06:25.073005+00:00"
- name: langchain-serpex-python
name_title: Serpex
repo: divyeshradadiya/langchain-serpex-python
js: langchain-serpex-js
downloads: 1000
downloads_updated_at: "2025-10-30T00:00:00.000000+00:00"
- name: langchain-serpex-js
name_title: Serpex
repo: divyeshradadiya/langchain-serpex-js
downloads: 1000
downloads_updated_at: "2025-10-30T00:00:00.000000+00:00"
15 changes: 15 additions & 0 deletions src/oss/javascript/integrations/providers/serpex-js.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Serpex (JS/TS)
---

This page covers how to use the Serpex search APIs within LangChain (JavaScript/TypeScript).

## Installation and Setup (JavaScript/TypeScript)
- Install the JS package with `npm install langchain-serpex-js` or `pnpm add langchain-serpex-js`
- Get a Serpex API key and set it as an environment variable (for example `SERPEX_API_KEY`).

## Wrappers / Tools

See the Serpex JS tool reference and examples here: [/oss/javascript/integrations/tools/serpex_search_js](/oss/javascript/integrations/tools/serpex_search_js)

For usage with Agents and loading as tools, see the tools documentation: [/oss/javascript/integrations/tools](/oss/javascript/integrations/tools).
122 changes: 122 additions & 0 deletions src/oss/javascript/integrations/tools/serpex_search_js.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: Serpex Search
---

[SERPEX](https://serpex.dev) is a powerful multi-engine search API that provides access to search results from Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex, and other search engines in JSON format. It's designed for developers building AI applications, SEO tools, market research platforms, and data aggregation services.

## Overview

### Integration details

| Class | Package | Local | Serializable | PY support | Package downloads | Package latest |
|-------|---------|-------|--------------|------------|------------------|----------------|
| [Serpex](https://github.com/divyeshradadiya/langchain-serpex-js) | [langchain-serpex-js](https://www.npmjs.com/package/langchain-serpex-js) | ✅ | ❌ | ✅ | ![NPM Downloads](https://img.shields.io/npm/dm/langchain-serpex-js) | ![NPM Version](https://img.shields.io/npm/v/langchain-serpex-js) |

### Tool features

| Returns artifact | Native async | Return data | Pricing |
|------------------|--------------|-------------|---------|
| ❌ | ✅ | title, URL, snippet, rich results | Free tier available |

## Setup

The integration lives in the `langchain-serpex-js` package.

```bash
npm install langchain-serpex-js
```

### Credentials

We also need to set our SERPEX API key. You can get an API key by visiting [serpex.dev](https://serpex.dev) and creating an account.

```typescript
// In your environment
process.env.SERPEX_API_KEY = "your-serpex-api-key";
```

## Instantiation

Here we show how to instantiate an instance of the Serpex search tool. The tool accepts various parameters to customize the search. After instantiation we invoke the tool with a simple query.

### Parameters

- `apiKey` (string): Your SERPEX API key (required if not set as environment variable)
- `engine` (string): Search engine to use - "auto", "google", "bing", "duckduckgo", "brave", "yahoo", "yandex" (default: "auto")
- `category` (string): Search category - currently only "web" is supported (default: "web")
- `time_range` (string): Time filter - "all", "day", "week", "month", "year" (not supported by Brave)

```typescript
import { Serpex } from "langchain-serpex-js";

const tool = new Serpex("your-serpex-api-key", {
engine: "google",
time_range: "month"
});
```

## Invocation

### Invoke directly with args

The Serpex search tool accepts the following arguments during invocation:
`query` (required): A natural language search query

```typescript
await tool.invoke({ query: "latest AI developments" });
```

### Invoke with ToolCall

We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:

```typescript
// This is usually generated by a model, but we'll create a tool call directly for demo purposes.
const modelGeneratedToolCall = {
args: { query: "quantum computing breakthroughs" },
id: "1",
name: "serpex_search",
type: "tool_call",
};

const toolMsg = await tool.invoke(modelGeneratedToolCall);

// The content is a JSON string of results
console.log(toolMsg.content.substring(0, 500));
```

## Use within an agent

We can use our tools directly with an agent by creating an agent with the tool. This gives the agent the ability to dynamically search for information.

```typescript
import { ChatOpenAI } from "@langchain/openai";
import { createAgent } from "langchain";
import { Serpex } from "langchain-serpex-js";

// Initialize the search tool
const searchTool = new Serpex("your-serpex-api-key", {
engine: "google",
time_range: "month"
});

// Initialize the LLM
const llm = new ChatOpenAI({ model: "gpt-4", temperature: 0 });

// Create an agent with the search tool
const agent = createAgent({
model: llm,
tools: [searchTool],
});

// Run the agent
const result = await agent.invoke({
messages: [{ role: "user", content: "What are the latest developments in renewable energy?" }]
});

console.log(result);
```

## API reference

For detailed documentation of all SERPEX API features and configurations head to the API reference: [serpex.dev/docs](https://serpex.dev/docs)
15 changes: 15 additions & 0 deletions src/oss/python/integrations/providers/serpex-python.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Serpex
---

This page covers how to use the Serpex search APIs within LangChain.

## Installation and Setup
- Install the Python package with `pip install langchain-serpex-python`
- Get a Serpex API key and set it as an environment variable (for example `SERPEX_API_KEY`).

## Wrappers

### Tool

For usage examples and reference for the Serpex wrappers and tools, see [the Serpex tools page](/oss/python/integrations/tools/serpex_search_python).
131 changes: 131 additions & 0 deletions src/oss/python/integrations/tools/serpex_search_python.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
title: Serpex Search
---

[SERPEX](https://serpex.dev) is a powerful multi-engine search API that provides access to search results from Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex, and other search engines in JSON format. It's designed for developers building AI applications, SEO tools, market research platforms, and data aggregation services.

## Overview

### Integration details

| Class | Package | Local | Serializable | JS support | Package downloads | Package latest |
|-------|----------|--------|--------------|-------------|------------------|----------------|
| [SerpexSearchResults](https://github.com/divyeshradadiya/langchain-serpex-python) | [langchain-serpex-python](https://pypi.org/project/langchain-serpex-python/) | ✅ | ❌ | ✅ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-serpex-python) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-serpex-python) |

### Tool features

| Returns artifact | Native async | Return data | Pricing |
|------------------|--------------|--------------|----------|
| ❌ | ✅ | title, URL, snippet, rich results | Free tier available |

## Setup

The integration lives in the `langchain-serpex-python` package.

```python
pip install -qU langchain-serpex-python
```

### Credentials

We also need to set our SERPEX API key. You can get an API key by visiting [serpex.dev](https://serpex.dev) and creating an account.

```python
import getpass
import os

if not os.environ.get("SERPEX_API_KEY"):
os.environ["SERPEX_API_KEY"] = getpass.getpass("SERPEX API key:\n")
```

## Instantiation

Here we show how to instantiate an instance of the Serpex search tool. The tool accepts various parameters to customize the search. After instantiation we invoke the tool with a simple query.

### Parameters

- `api_key` (str): Your SERPEX API key (required if not set as environment variable)
- `engine` (str): Search engine to use - "auto", "google", "bing", "duckduckgo", "brave", "yahoo", "yandex" (default: "auto")
- `category` (str): Search category - currently only "web" is supported (default: "web")
- `time_range` (str): Time filter - "all", "day", "week", "month", "year" (not supported by Brave)

```python
from langchain_serpex_python import SerpexSearchResults

tool = SerpexSearchResults(
api_key="your-serpex-api-key",
engine="google",
time_range="month"
)
```

## Invocation

### Invoke directly with args

The Serpex search tool accepts the following arguments during invocation:
`query` (required): A natural language search query

```python
tool.invoke({"query": "latest AI developments"})
```

### Invoke with ToolCall

We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:

```python
# This is usually generated by a model, but we'll create a tool call directly for demo purposes.
model_generated_tool_call = {
"args": {"query": "quantum computing breakthroughs"},
"id": "1",
"name": "serpex_search",
"type": "tool_call",
}
tool_msg = tool.invoke(model_generated_tool_call)

# The content is a JSON string of results
print(tool_msg.content[:500])
```

## Use within an agent

We can use our tools directly with an agent executor by binding the tool to the agent. This gives the agent the ability to dynamically search for information.

```python
if not os.environ.get("OPENAI_API_KEY"):
os.environ["OPENAI_API_KEY"] = getpass.getpass("OPENAI_API_KEY:\n")

# (output: false, echo: false)
# !pip install -qU langchain langchain-openai
from langchain.chat_models import init_chat_model

model = init_chat_model(model="gpt-4o", model_provider="openai", temperature=0)

# We will need to install langgraph:
# !pip install -qU langgraph

from langchain_serpex_python import SerpexSearchResults
from langchain.agents import create_agent

# Initialize Serpex Search Tool
serpex_search_tool = SerpexSearchResults(
api_key="your-serpex-api-key",
engine="google",
time_range="month"
)

agent = create_agent(model, [serpex_search_tool])

user_input = "What are the latest developments in renewable energy?"

for step in agent.stream(
{"messages": user_input},
stream_mode="values",
):
step["messages"][-1].pretty_print()
```

## API reference

For detailed documentation of all SERPEX API features and configurations head to the API reference: [serpex.dev/docs](https://serpex.dev/docs)