Home / Function/ test_parse_nested_structured_output_with_think_tags() — langchain Function Reference

test_parse_nested_structured_output_with_think_tags() — langchain Function Reference

Architecture documentation for the test_parse_nested_structured_output_with_think_tags() function in test_output_parsers.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  67c04840_292f_8c8c_71a6_9fc40f74d48b["test_parse_nested_structured_output_with_think_tags()"]
  78e02bb9_2694_e9a5_aaa1_e8312a190104["TestReasoningStructuredOutputParser"]
  67c04840_292f_8c8c_71a6_9fc40f74d48b -->|defined in| 78e02bb9_2694_e9a5_aaa1_e8312a190104
  style 67c04840_292f_8c8c_71a6_9fc40f74d48b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/perplexity/tests/unit_tests/test_output_parsers.py lines 251–272

    def test_parse_nested_structured_output_with_think_tags(self) -> None:
        """Test parsing nested Pydantic models with think tags."""
        parser: ReasoningStructuredOutputParser[MockCompany] = (
            ReasoningStructuredOutputParser(pydantic_object=MockCompany)
        )
        text = """<think>Creating company with employees</think>
{
    "company_name": "Tech Corp",
    "founded_year": 2020,
    "employees": [
        {"name": "John", "age": 30},
        {"name": "Jane", "age": 28}
    ]
}"""
        generation = Generation(text=text)
        result = parser.parse_result([generation])
        assert isinstance(result, MockCompany)
        assert result.company_name == "Tech Corp"
        assert result.founded_year == 2020
        assert len(result.employees) == 2
        assert result.employees[0].name == "John"
        assert result.employees[1].name == "Jane"

Domain

Subdomains

Frequently Asked Questions

What does test_parse_nested_structured_output_with_think_tags() do?
test_parse_nested_structured_output_with_think_tags() is a function in the langchain codebase, defined in libs/partners/perplexity/tests/unit_tests/test_output_parsers.py.
Where is test_parse_nested_structured_output_with_think_tags() defined?
test_parse_nested_structured_output_with_think_tags() is defined in libs/partners/perplexity/tests/unit_tests/test_output_parsers.py at line 251.

Analyze Your Own Codebase

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

Try Supermodel Free