test_react_single_input.py — langchain Source File
Architecture documentation for test_react_single_input.py, a python file in the langchain codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d02558d7_3d60_16fd_ff0e_bce803d6a351["test_react_single_input.py"] f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] d02558d7_3d60_16fd_ff0e_bce803d6a351 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 59e0d3b0_0f8e_4b79_d442_e9b4821561c7["langchain_core.agents"] d02558d7_3d60_16fd_ff0e_bce803d6a351 --> 59e0d3b0_0f8e_4b79_d442_e9b4821561c7 049d69ec_d53a_d170_b6fa_35c395793702["langchain_core.exceptions"] d02558d7_3d60_16fd_ff0e_bce803d6a351 --> 049d69ec_d53a_d170_b6fa_35c395793702 dd55d8d2_6935_220e_f65d_3f59dd6c3571["langchain_classic.agents.output_parsers.react_single_input"] d02558d7_3d60_16fd_ff0e_bce803d6a351 --> dd55d8d2_6935_220e_f65d_3f59dd6c3571 style d02558d7_3d60_16fd_ff0e_bce803d6a351 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.exceptions import OutputParserException
from langchain_classic.agents.output_parsers.react_single_input import (
ReActSingleInputOutputParser,
)
def test_action() -> None:
"""Test standard parsing of action/action input."""
parser = ReActSingleInputOutputParser()
_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 = ReActSingleInputOutputParser()
_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
def test_action_with_finish() -> None:
"""Test that if final thought is in action/action input, error is raised."""
parser = ReActSingleInputOutputParser()
_input = """Thought: agent thought here
Action: search Final Answer:
Action Input: what is the temperature in SF?"""
with pytest.raises(OutputParserException):
parser.invoke(_input)
Domain
Subdomains
Dependencies
- langchain_classic.agents.output_parsers.react_single_input
- langchain_core.agents
- langchain_core.exceptions
- pytest
Source
Frequently Asked Questions
What does test_react_single_input.py do?
test_react_single_input.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_react_single_input.py?
test_react_single_input.py defines 3 function(s): test_action, test_action_with_finish, test_finish.
What does test_react_single_input.py depend on?
test_react_single_input.py imports 4 module(s): langchain_classic.agents.output_parsers.react_single_input, langchain_core.agents, langchain_core.exceptions, pytest.
Where is test_react_single_input.py in the architecture?
test_react_single_input.py is located at libs/langchain/tests/unit_tests/agents/output_parsers/test_react_single_input.py (domain: LangChainCore, subdomain: MessageInterface, 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