Skip to content

Conversation

@divyeshradadiya
Copy link

Overview

Adds comprehensive Serpex search API integration documentation for both Python and JavaScript platforms, including tool documentation, provider pages, and package registry updates.

Type of change

Type: New documentation page

Related issues/PRs

  • GitHub issue:
  • Feature PR:
  • Linear issue:
  • Slack thread:

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • 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

Additional notes

Changes Made:

  1. Tool Documentation:

    • Added src/oss/python/integrations/tools/serpex_search_python.mdx - Python Serpex tool documentation
    • Added src/oss/javascript/integrations/tools/serpex_search_js.mdx - JavaScript Serpex tool documentation
  2. Provider Pages:

    • Added src/oss/python/integrations/providers/serpex-python.mdx - Python provider page
    • Added src/oss/javascript/integrations/providers/serpex-js.mdx - JavaScript provider page
  3. Package Registry:

    • Updated reference/packages.yml to include both langchain-serpex-python and langchain-serpex-js packages
    • Added cross-platform references (js: langchain-serpex-js for Python package)
  4. Partner Package Table:

    • Updated pipeline/tools/partner_pkg_table.py to include Serpex entries

Features Documented:

  • Multi-engine search support: Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex
  • Native async support: Both Python and JavaScript implementations support async operations
  • Cross-platform compatibility: Python package references JS counterpart and vice versa
  • Free tier available: Pricing information included
  • Comprehensive API documentation: Installation, setup, usage examples, and parameter details

Testing:

  • Integration components verified through automated testing
  • Documentation structure validated
  • Cross-platform references confirmed
  • Package registry entries validated

@github-actions github-actions bot added langchain For docs changes to LangChain python For content related to the Python version of LangChain projects oss javascript docs-infra labels Oct 31, 2025
Copilot AI review requested due to automatic review settings November 2, 2025 14:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds documentation for the Serpex search integration to LangChain, providing both Python and JavaScript/TypeScript implementations. Serpex is a multi-engine search API that provides access to results from Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex, and other search engines.

Key changes:

  • Added comprehensive tool documentation for both Python and JavaScript implementations
  • Added provider documentation pages for both languages
  • Updated the packages registry with Serpex package metadata
  • Minor type annotation improvement in the partner package table script

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/oss/python/integrations/tools/serpex_search_python.mdx Python tool documentation with setup, instantiation, invocation examples, and agent integration
src/oss/python/integrations/providers/serpex-python.mdx Python provider overview with installation instructions and tool loading examples
src/oss/javascript/integrations/tools/serpex_search_js.mdx JavaScript/TypeScript tool documentation with setup, instantiation, invocation examples, and agent integration
src/oss/javascript/integrations/providers/serpex-js.mdx JavaScript provider overview with installation instructions and usage references
reference/packages.yml Added Serpex package entries to the package registry
pipeline/tools/partner_pkg_table.py Updated type annotation from union syntax to Optional for better compatibility
Comments suppressed due to low confidence (1)

src/oss/python/integrations/tools/serpex_search_python.mdx:1

  • The load_tools function from langchain_community.agent_toolkits.load_tools is a legacy pattern for loading tools. This approach is not consistently used in modern LangChain documentation and may be deprecated. Consider removing this section or documenting the direct instantiation approach instead, which is already covered in the main tool documentation.
---

Comment on lines 94 to 130
import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
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 prompt = ChatPromptTemplate.fromMessages([
["system", "You are a helpful assistant."],
["human", "{input}"],
["human", "{agent_scratchpad}"]
]);

const agent = await createOpenAIFunctionsAgent({
llm,
tools: [searchTool],
prompt
});

const executor = new AgentExecutor({
agent,
tools: [searchTool]
});

// Run the agent
const result = await executor.invoke({
input: "What are the latest developments in renewable energy?"
});

console.log(result);
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

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

The JavaScript agent example uses createOpenAIFunctionsAgent and AgentExecutor, which is an older agent pattern. Modern LangChain documentation typically uses LangGraph for agent creation. Consider updating this example to use LangGraph's createReactAgent or a similar modern pattern to align with current best practices and other tool documentation in the repository.

Copilot uses AI. Check for mistakes.
Comment on lines 17 to 26
### Tool (Agent)

You can also load Serpex as a Tool to use with an Agent:

```python
from langchain_community.agent_toolkits.load_tools import load_tools
tools = load_tools(["serpex_search_python"])
```

For more information on loading tools, see [the tools documentation](/oss/integrations/tools).
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

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

The load_tools function is a legacy pattern. Since the main tool documentation already demonstrates direct instantiation with SerpexSearchResults, this section may be redundant or should clarify when this legacy approach should be used versus direct instantiation.

Suggested change
### Tool (Agent)
You can also load Serpex as a Tool to use with an Agent:
```python
from langchain_community.agent_toolkits.load_tools import load_tools
tools = load_tools(["serpex_search_python"])
```
For more information on loading tools, see [the tools documentation](/oss/integrations/tools).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-infra javascript langchain For docs changes to LangChain oss python For content related to the Python version of LangChain projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant