- 
                Notifications
    
You must be signed in to change notification settings  - Fork 514
 
docs: add Serpex integration docs (Python & JS) and update packages.yml #1210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs: add Serpex integration docs (Python & JS) and update packages.yml #1210
Conversation
There was a problem hiding this 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_toolsfunction fromlangchain_community.agent_toolkits.load_toolsis 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. 
---
| 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); | 
    
      
    
      Copilot
AI
    
    
    
      Nov 2, 2025 
    
  
There was a problem hiding this comment.
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.
| ### 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
AI
    
    
    
      Nov 2, 2025 
    
  
There was a problem hiding this comment.
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.
| ### 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). | 
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
Checklist
docs devsrc/docs.jsonif neededAdditional notes
Changes Made:
Tool Documentation:
src/oss/python/integrations/tools/serpex_search_python.mdx- Python Serpex tool documentationsrc/oss/javascript/integrations/tools/serpex_search_js.mdx- JavaScript Serpex tool documentationProvider Pages:
src/oss/python/integrations/providers/serpex-python.mdx- Python provider pagesrc/oss/javascript/integrations/providers/serpex-js.mdx- JavaScript provider pagePackage Registry:
reference/packages.ymlto include bothlangchain-serpex-pythonandlangchain-serpex-jspackagesjs: langchain-serpex-jsfor Python package)Partner Package Table:
pipeline/tools/partner_pkg_table.pyto include Serpex entriesFeatures Documented:
Testing: