Home / File/ test_convo_output_parser.py — langchain Source File

test_convo_output_parser.py — langchain Source File

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

File python CoreAbstractions MessageSchema 2 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  5c6b9ec7_4c2f_7c3c_19fc_2c8a2fd95b9c["test_convo_output_parser.py"]
  80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b["langchain_core.agents"]
  5c6b9ec7_4c2f_7c3c_19fc_2c8a2fd95b9c --> 80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b
  38407f22_8bf0_e5e0_d4a3_737768ae0b76["langchain_classic.agents.conversational.output_parser"]
  5c6b9ec7_4c2f_7c3c_19fc_2c8a2fd95b9c --> 38407f22_8bf0_e5e0_d4a3_737768ae0b76
  style 5c6b9ec7_4c2f_7c3c_19fc_2c8a2fd95b9c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.agents import AgentAction

from langchain_classic.agents.conversational.output_parser import ConvoOutputParser


def test_normal_output_parsing() -> None:
    _test_convo_output(
        """
Action: my_action
Action Input: my action input
""",
        "my_action",
        "my action input",
    )


def test_multiline_output_parsing() -> None:
    _test_convo_output(
        """
Thought: Do I need to use a tool? Yes
Action: evaluate_code
Action Input: Evaluate Code with the following Python content:
```python
print("Hello fifty shades of gray mans!"[::-1])  # noqa: T201
```
""",
        "evaluate_code",
        """
Evaluate Code with the following Python content:
```python
print("Hello fifty shades of gray mans!"[::-1])  # noqa: T201
```""".lstrip(),
    )


def _test_convo_output(text: str, expected_tool: str, expected_tool_input: str) -> None:
    result = ConvoOutputParser().parse(text.strip())
    assert isinstance(result, AgentAction)
    assert result.tool == expected_tool
    assert result.tool_input == expected_tool_input

Subdomains

Dependencies

  • langchain_classic.agents.conversational.output_parser
  • langchain_core.agents

Frequently Asked Questions

What does test_convo_output_parser.py do?
test_convo_output_parser.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_convo_output_parser.py?
test_convo_output_parser.py defines 3 function(s): _test_convo_output, test_multiline_output_parsing, test_normal_output_parsing.
What does test_convo_output_parser.py depend on?
test_convo_output_parser.py imports 2 module(s): langchain_classic.agents.conversational.output_parser, langchain_core.agents.
Where is test_convo_output_parser.py in the architecture?
test_convo_output_parser.py is located at libs/langchain/tests/unit_tests/agents/output_parsers/test_convo_output_parser.py (domain: CoreAbstractions, subdomain: MessageSchema, 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