langchain - ✅(Solved) Fix feat(langchain-classic): register perplexity_search in load_tools for PerplexitySearchResults [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#37089Fetched 2026-04-30 06:18:33
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
0
Participants
Assignees
Timeline (top)
labeled ×2assigned ×1closed ×1commented ×1

Error Message

from langchain.agents import load_tools tools = load_tools(["perplexity_search"]) # raises: ValueError: Got unknown tool perplexity_search

Root Cause

I have a working implementation ready (lint + 647 tests passing locally) at PR #37083, which was auto-closed because there was no linked issue. Filing this issue per the contributor policy and would like to be assigned (@james-pplx) so the PR can be reopened. Thanks!

Fix Action

Fixed

PR fix notes

PR #37083: feat(langchain): register perplexity_search in load_tools registry

Description (problem / solution / changelog)

Closes #37089


Registers perplexity_search as a string-loadable tool name in langchain_classic.agents.load_tools, so that load_tools(["perplexity_search"]) returns a [PerplexitySearchResults()] from the langchain-perplexity partner package.

The factory lazily imports langchain_perplexity and raises a friendly ImportError ("Install langchain-perplexity: pip install -U langchain-perplexity") when the package is missing, mirroring the lazy-import / pip-install-hint pattern used for the other partner-package tools registered in langchain_community.agent_toolkits.load_tools (e.g. serpapi, metaphor-search).

The local load_tools and get_all_tool_names wrap the community implementations: perplexity_search is handled locally; every other name passes through to langchain_community unchanged.

tests/unit_tests/test_imports.py::test_no_more_changes_to_proxy_community is hash-based and intentionally bumped to reflect the redirect of load_tools / get_all_tool_names from langchain_community to the local module — this is a reduction of imports from langchain into langchain_community, which is the direction the test guards.

Verification

  • make format — clean
  • make lint — clean (ruff + mypy)
  • make test from libs/langchain/ — 647 passed, 84 skipped, 1 xfailed
  • New unit test tests/unit_tests/agents/test_load_tools.py does NOT require langchain-perplexity or any API key (uses monkeypatch on __import__ to assert the install-hint message).

Social handles (optional)

Twitter: @ LinkedIn: https://linkedin.com/in/

Changed files

  • libs/langchain/langchain_classic/agents/__init__.py (modified, +7/-4)
  • libs/langchain/langchain_classic/agents/load_tools.py (modified, +52/-1)
  • libs/langchain/tests/unit_tests/agents/test_load_tools.py (added, +52/-0)
  • libs/langchain/tests/unit_tests/test_imports.py (modified, +1/-1)

Code Example

from langchain.agents import load_tools
tools = load_tools(["perplexity_search"])  # raises: ValueError: Got unknown tool perplexity_search

---

from langchain_perplexity import PerplexitySearchResults
tools = [PerplexitySearchResults()]
RAW_BUFFERClick to expand / collapse

Submission checklist

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Feature Description

langchain-perplexity ships a first-class PerplexitySearchResults tool (alongside ChatPerplexity and PerplexitySearchRetriever), but unlike other partner-package tools it can't be loaded by string name via load_tools:

from langchain.agents import load_tools
tools = load_tools(["perplexity_search"])  # raises: ValueError: Got unknown tool perplexity_search

This requires users to import the class directly, which is inconsistent with how other partner integrations are surfaced (e.g. serpapi, metaphor-search, google-search).

Use Case

Make PerplexitySearchResults discoverable through the canonical load_tools entry point so it's on equal footing with other search/retrieval tools. This is a small registration change with no new dependencies — langchain-perplexity is imported lazily and only when the user requests this tool by name.

Proposed Solution

Register perplexity_search in libs/langchain/langchain_classic/agents/load_tools.py with a lazy importer that raises a friendly ImportError ("Install langchain-perplexity: pip install -U langchain-perplexity") if the partner package isn't installed — same pattern used for other optional partner tools.

I have a working implementation ready (lint + 647 tests passing locally) at PR #37083, which was auto-closed because there was no linked issue. Filing this issue per the contributor policy and would like to be assigned (@james-pplx) so the PR can be reopened. Thanks!

Alternatives Considered

No response

Additional Context

Users can currently work around this by importing PerplexitySearchResults directly:

from langchain_perplexity import PerplexitySearchResults
tools = [PerplexitySearchResults()]

However, this is inconsistent with the load_tools pattern used by all other search integrations and creates an uneven developer experience for users of langchain-perplexity.

extent analysis

TL;DR

Register perplexity_search in load_tools.py to enable lazy loading of PerplexitySearchResults via the load_tools function.

Guidance

  • Verify that the langchain-perplexity package is installed and imported correctly to ensure the PerplexitySearchResults tool is available.
  • Check the load_tools.py file for the registration pattern used for other partner tools, such as serpapi and metaphor-search, to inform the registration of perplexity_search.
  • Implement a lazy importer for perplexity_search that raises a friendly ImportError if the langchain-perplexity package is not installed.
  • Test the updated load_tools function with the perplexity_search tool to ensure it works as expected.

Example

from langchain.agents import load_tools
tools = load_tools(["perplexity_search"])  # should load PerplexitySearchResults without raising an error

Notes

The proposed solution requires updating the load_tools.py file, which may have implications for other parts of the codebase. It's essential to review and test the changes thoroughly to ensure they do not introduce any regressions.

Recommendation

Apply the workaround by registering perplexity_search in load_tools.py to provide a consistent developer experience for users of langchain-perplexity. This change is a small registration update with no new dependencies, making it a low-risk solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING