test_render.py — langchain Source File
Architecture documentation for test_render.py, a python file in the langchain codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR edd81e02_1c8e_419b_c1b9_95d937d5af2c["test_render.py"] f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] edd81e02_1c8e_419b_c1b9_95d937d5af2c --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 121262a1_0bd6_d637_bce3_307ab6b3ecd4["langchain_core.tools"] edd81e02_1c8e_419b_c1b9_95d937d5af2c --> 121262a1_0bd6_d637_bce3_307ab6b3ecd4 236d9b11_0cd4_57c7_bfd3_0c5f6417925c["langchain_classic.tools.render"] edd81e02_1c8e_419b_c1b9_95d937d5af2c --> 236d9b11_0cd4_57c7_bfd3_0c5f6417925c style edd81e02_1c8e_419b_c1b9_95d937d5af2c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from langchain_core.tools import BaseTool, tool
from langchain_classic.tools.render import (
render_text_description,
render_text_description_and_args,
)
@tool
def search(query: str) -> str: # noqa: ARG001
"""Lookup things online."""
return "foo"
@tool
def calculator(expression: str) -> str: # noqa: ARG001
"""Do math."""
return "bar"
@pytest.fixture
def tools() -> list[BaseTool]:
return [search, calculator]
def test_render_text_description(tools: list[BaseTool]) -> None:
tool_string = render_text_description(tools)
expected_string = """search(query: str) -> str - Lookup things online.
calculator(expression: str) -> str - Do math."""
assert tool_string == expected_string
def test_render_text_description_and_args(tools: list[BaseTool]) -> None:
tool_string = render_text_description_and_args(tools)
expected_string = """search(query: str) -> str - Lookup things online., \
args: {'query': {'title': 'Query', 'type': 'string'}}
calculator(expression: str) -> str - Do math., \
args: {'expression': {'title': 'Expression', 'type': 'string'}}"""
assert tool_string == expected_string
Domain
Subdomains
Functions
Dependencies
- langchain_classic.tools.render
- langchain_core.tools
- pytest
Source
Frequently Asked Questions
What does test_render.py do?
test_render.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in test_render.py?
test_render.py defines 5 function(s): calculator, search, test_render_text_description, test_render_text_description_and_args, tools.
What does test_render.py depend on?
test_render.py imports 3 module(s): langchain_classic.tools.render, langchain_core.tools, pytest.
Where is test_render.py in the architecture?
test_render.py is located at libs/langchain/tests/unit_tests/tools/test_render.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/langchain/tests/unit_tests/tools).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free