langchain - 💡(How to fix) Fix feat(langchain-classic): register `perplexity_search` in load_tools for PerplexitySearchResults [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#37088Fetched 2026-04-30 06:18:34
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
closed ×1commented ×1labeled ×1mentioned ×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!

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

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

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 with a lazy importer to make PerplexitySearchResults discoverable.

Guidance

  • Register perplexity_search in libs/langchain/langchain_classic/agents/load_tools.py to enable loading by string name via load_tools.
  • Implement a lazy importer that raises a friendly ImportError if langchain-perplexity is not installed.
  • Verify the fix by attempting to load perplexity_search using load_tools after applying the registration change.
  • Test the lazy importer by trying to load perplexity_search without having langchain-perplexity installed.

Example

from langchain.agents import load_tools
tools = load_tools(["perplexity_search"])  # should now succeed if langchain-perplexity is installed

Notes

This solution assumes that the langchain-perplexity package is intended to be an optional dependency, and the lazy importer should handle cases where it is not installed.

Recommendation

Apply the proposed 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.

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