Home / Function/ test_pro_search() — langchain Function Reference

test_pro_search() — langchain Function Reference

Architecture documentation for the test_pro_search() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fc634cbc_84a6_4b8b_0d52_511f11b72627["test_pro_search()"]
  974a163b_6ea0_9385_8678_c36e3c96fcdf["TestChatPerplexityIntegration"]
  fc634cbc_84a6_4b8b_0d52_511f11b72627 -->|defined in| 974a163b_6ea0_9385_8678_c36e3c96fcdf
  style fc634cbc_84a6_4b8b_0d52_511f11b72627 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/perplexity/tests/integration_tests/test_chat_models.py lines 29–51

    def test_pro_search(self) -> None:
        """Test Pro Search (reasoning_steps extraction)."""
        # Pro search is available on sonar-pro
        chat = ChatPerplexity(
            model="sonar-pro",
            temperature=0,
            web_search_options=WebSearchOptions(search_type="pro"),
            streaming=True,
        )
        message = HumanMessage(content="Who won the 2024 US election and why?")

        # We need to collect chunks to check reasoning steps
        chunks = list(chat.stream([message]))
        full_content = "".join(c.content for c in chunks if isinstance(c.content, str))
        assert full_content

        # Check if any chunk has reasoning_steps
        has_reasoning = any("reasoning_steps" in c.additional_kwargs for c in chunks)
        if has_reasoning:
            assert True
        else:
            # Fallback assertion if no reasoning steps returned
            assert len(chunks) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_pro_search() do?
test_pro_search() is a function in the langchain codebase, defined in libs/partners/perplexity/tests/integration_tests/test_chat_models.py.
Where is test_pro_search() defined?
test_pro_search() is defined in libs/partners/perplexity/tests/integration_tests/test_chat_models.py at line 29.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free