Home / Function/ test_parser_with_think_tags_in_json_values() — langchain Function Reference

test_parser_with_think_tags_in_json_values() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/perplexity/tests/unit_tests/test_output_parsers.py lines 327–338

    def test_parser_with_think_tags_in_json_values(self) -> None:
        """Test that think tags in JSON string values don't cause issues."""
        parser: ReasoningStructuredOutputParser[MockPerson] = (
            ReasoningStructuredOutputParser(pydantic_object=MockPerson)
        )
        # Think tags should be stripped before JSON parsing, so they won't be in values
        text = '<think>reasoning</think>{"name": "John <Doe>", "age": 30}'
        generation = Generation(text=text)
        result = parser.parse_result([generation])
        assert isinstance(result, MockPerson)
        assert result.name == "John <Doe>"
        assert result.age == 30

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free