Home / File/ test_search_tool.py — langchain Source File

test_search_tool.py — langchain Source File

Architecture documentation for test_search_tool.py, a python file in the langchain codebase. 1 imports, 0 dependents.

File python CoreAbstractions MessageSchema 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  a966d152_1ec8_b280_4fe4_842a4b6e1063["test_search_tool.py"]
  a6947a84_a966_127d_d3a6_ed52b7ab3656["langchain_exa"]
  a966d152_1ec8_b280_4fe4_842a4b6e1063 --> a6947a84_a966_127d_d3a6_ed52b7ab3656
  style a966d152_1ec8_b280_4fe4_842a4b6e1063 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Integration tests for Exa search tool."""

from langchain_exa import (
    ExaSearchResults,  # type: ignore[import-not-found, import-not-found]
)


def test_search_tool() -> None:
    """Test that the Exa search tool works."""
    tool = ExaSearchResults()
    res = tool.invoke({"query": "best time to visit japan", "num_results": 5})
    print(res)  # noqa: T201
    assert not isinstance(res, str)  # str means error for this tool\


def test_search_tool_advanced_features() -> None:
    """Test advanced features of the Exa search tool."""
    tool = ExaSearchResults()
    res = tool.invoke(
        {
            "query": "best time to visit japan",
            "num_results": 3,
            "text_contents_options": {"max_characters": 1000},
            "summary": True,
            "type": "auto",
        }
    )
    print(res)  # noqa: T201
    assert not isinstance(res, str)  # str means error for this tool
    assert len(res.results) == 3
    # Verify summary exists
    assert hasattr(res.results[0], "summary")
    # Verify text was limited
    assert len(res.results[0].text) <= 1000

Subdomains

Dependencies

  • langchain_exa

Frequently Asked Questions

What does test_search_tool.py do?
test_search_tool.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_search_tool.py?
test_search_tool.py defines 2 function(s): test_search_tool, test_search_tool_advanced_features.
What does test_search_tool.py depend on?
test_search_tool.py imports 1 module(s): langchain_exa.
Where is test_search_tool.py in the architecture?
test_search_tool.py is located at libs/partners/exa/tests/integration_tests/test_search_tool.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/partners/exa/tests/integration_tests).

Analyze Your Own Codebase

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

Try Supermodel Free