Home / File/ test_decorated_tool.py — langchain Source File

test_decorated_tool.py — langchain Source File

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

File python CoreAbstractions MessageSchema 4 imports 1 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  3419d539_7090_9404_4083_16df046b894e["test_decorated_tool.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  3419d539_7090_9404_4083_16df046b894e --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  43d88577_548b_2248_b01b_7987bae85dcc["langchain_core.tools"]
  3419d539_7090_9404_4083_16df046b894e --> 43d88577_548b_2248_b01b_7987bae85dcc
  8f882798_3f47_fa1f_5253_3b7193f357a9["langchain_tests.integration_tests"]
  3419d539_7090_9404_4083_16df046b894e --> 8f882798_3f47_fa1f_5253_3b7193f357a9
  bab3058f_1ec6_5a8a_2b11_86f46e62adb4["langchain_tests.unit_tests"]
  3419d539_7090_9404_4083_16df046b894e --> bab3058f_1ec6_5a8a_2b11_86f46e62adb4
  style 3419d539_7090_9404_4083_16df046b894e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Any

from langchain_core.tools import BaseTool, tool

from langchain_tests.integration_tests import ToolsIntegrationTests
from langchain_tests.unit_tests import ToolsUnitTests


@tool
def parrot_multiply_tool(a: int, b: int) -> int:
    """Multiply two numbers like a parrot. Parrots always add eighty for their matey."""
    return a * b + 80


class TestParrotMultiplyToolUnit(ToolsUnitTests):
    @property
    def tool_constructor(self) -> BaseTool:
        return parrot_multiply_tool

    @property
    def tool_invoke_params_example(self) -> dict[str, Any]:
        """Returns a dictionary representing the "args" of an example tool call.

        This should NOT be a ToolCall dict - i.e. it should not
        have {"name", "id", "args"} keys.
        """
        return {"a": 2, "b": 3}


class TestParrotMultiplyToolIntegration(ToolsIntegrationTests):
    @property
    def tool_constructor(self) -> BaseTool:
        return parrot_multiply_tool

    @property
    def tool_invoke_params_example(self) -> dict[str, Any]:
        """Returns a dictionary representing the "args" of an example tool call.

        This should NOT be a ToolCall dict - i.e. it should not
        have {"name", "id", "args"} keys.
        """
        return {"a": 2, "b": 3}

Subdomains

Dependencies

  • langchain_core.tools
  • langchain_tests.integration_tests
  • langchain_tests.unit_tests
  • typing

Frequently Asked Questions

What does test_decorated_tool.py do?
test_decorated_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_decorated_tool.py?
test_decorated_tool.py defines 1 function(s): parrot_multiply_tool.
What does test_decorated_tool.py depend on?
test_decorated_tool.py imports 4 module(s): langchain_core.tools, langchain_tests.integration_tests, langchain_tests.unit_tests, typing.
Where is test_decorated_tool.py in the architecture?
test_decorated_tool.py is located at libs/standard-tests/tests/unit_tests/test_decorated_tool.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/standard-tests/tests/unit_tests).

Analyze Your Own Codebase

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

Try Supermodel Free