Home / Function/ test_json_output_function_parser_strictness() — langchain Function Reference

test_json_output_function_parser_strictness() — langchain Function Reference

Architecture documentation for the test_json_output_function_parser_strictness() function in test_openai_functions.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  44bc084d_5612_978e_00b4_2685af21a0b7["test_json_output_function_parser_strictness()"]
  051794f3_743e_b482_fc72_029694e0fa16["test_openai_functions.py"]
  44bc084d_5612_978e_00b4_2685af21a0b7 -->|defined in| 051794f3_743e_b482_fc72_029694e0fa16
  style 44bc084d_5612_978e_00b4_2685af21a0b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_openai_functions.py lines 88–108

def test_json_output_function_parser_strictness(config: dict[str, Any]) -> None:
    """Test parsing with JSON strictness on and off."""
    args = config["args"]

    message = AIMessage(
        content="This is a test message",
        additional_kwargs={
            "function_call": {"name": "function_name", "arguments": args}
        },
    )
    chat_generation = ChatGeneration(message=message)

    # Full output
    parser = JsonOutputFunctionsParser(
        strict=config["strict"], args_only=config["args_only"]
    )
    if config["exception"] is not None:
        with pytest.raises(config["exception"]):
            parser.parse_result([chat_generation])
    else:
        assert parser.parse_result([chat_generation]) == config["result"]

Domain

Subdomains

Frequently Asked Questions

What does test_json_output_function_parser_strictness() do?
test_json_output_function_parser_strictness() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_openai_functions.py.
Where is test_json_output_function_parser_strictness() defined?
test_json_output_function_parser_strictness() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_functions.py at line 88.

Analyze Your Own Codebase

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

Try Supermodel Free