def test_process_streaming_content_incremental_malformed_json():
    """Test processing malformed JSON with current object."""
    current_show = Show(
        title="Comedy Show",
        jokes=[Joke(setup="First joke", punchline="First punchline")],
    )

    response = ChatResponse(
        message=ChatMessage(
            role=MessageRole.ASSISTANT,
            content='{"jokes": [{"setup": "Second joke", "punchline": "Second punchline"}',
        )
    )

    result = process_streaming_content_incremental(response, Show, current_show)
    # Should attempt to extract partial progress
    assert hasattr(result, "jokes")
Test processing malformed JSON with current object.
llama-index-core/tests/program/test_streaming_utils.py