Home / File/ test_react_json_single_input.py — langchain Source File

test_react_json_single_input.py — langchain Source File

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

File python LangChainCore ApiManagement 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  693f10e9_0670_0fc2_07b5_f6aa601250db["test_react_json_single_input.py"]
  59e0d3b0_0f8e_4b79_d442_e9b4821561c7["langchain_core.agents"]
  693f10e9_0670_0fc2_07b5_f6aa601250db --> 59e0d3b0_0f8e_4b79_d442_e9b4821561c7
  a3833dc0_936e_b286_ce9e_0d0e3656fa95["langchain_classic.agents.output_parsers.react_json_single_input"]
  693f10e9_0670_0fc2_07b5_f6aa601250db --> a3833dc0_936e_b286_ce9e_0d0e3656fa95
  style 693f10e9_0670_0fc2_07b5_f6aa601250db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.agents import AgentAction, AgentFinish

from langchain_classic.agents.output_parsers.react_json_single_input import (
    ReActJsonSingleInputOutputParser,
)


def test_action() -> None:
    """Test standard parsing of action/action input."""
    parser = ReActJsonSingleInputOutputParser()
    _input = """Thought: agent thought here
```
{
    "action": "search",
    "action_input": "what is the temperature in SF?"
}
```
"""
    output = parser.invoke(_input)
    expected_output = AgentAction(
        tool="search",
        tool_input="what is the temperature in SF?",
        log=_input,
    )
    assert output == expected_output


def test_finish() -> None:
    """Test standard parsing of agent finish."""
    parser = ReActJsonSingleInputOutputParser()
    _input = """Thought: agent thought here
Final Answer: The temperature is 100"""
    output = parser.invoke(_input)
    expected_output = AgentFinish(
        return_values={"output": "The temperature is 100"},
        log=_input,
    )
    assert output == expected_output

Domain

Subdomains

Dependencies

  • langchain_classic.agents.output_parsers.react_json_single_input
  • langchain_core.agents

Frequently Asked Questions

What does test_react_json_single_input.py do?
test_react_json_single_input.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, ApiManagement subdomain.
What functions are defined in test_react_json_single_input.py?
test_react_json_single_input.py defines 2 function(s): test_action, test_finish.
What does test_react_json_single_input.py depend on?
test_react_json_single_input.py imports 2 module(s): langchain_classic.agents.output_parsers.react_json_single_input, langchain_core.agents.
Where is test_react_json_single_input.py in the architecture?
test_react_json_single_input.py is located at libs/langchain/tests/unit_tests/agents/output_parsers/test_react_json_single_input.py (domain: LangChainCore, subdomain: ApiManagement, directory: libs/langchain/tests/unit_tests/agents/output_parsers).

Analyze Your Own Codebase

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

Try Supermodel Free