def test_stream_chat_with_content(mock_stream_chat):
    """Test stream_chat method with content in delta."""
    # Create a mock for the response
    mock_chunk = MagicMock()
    mock_chunk.delta = "Test content"

    # Set up the mock to return our test chunk
    mock_stream_chat.return_value = [mock_chunk]

    # Create the ASI instance
    llm = ASI(api_key="test_key")

    # Call stream_chat
    messages = [ChatMessage(role=MessageRole.USER, content="Test message")]
    stream = llm.stream_chat(messages)

    # Check that we get the expected response
    chunks = list(stream)
    assert len(chunks) == 1
    assert chunks[0].delta == "Test content"

    # Verify that stream_chat was called with the right arguments
    mock_stream_chat.assert_called_once_with(messages)
Test stream_chat method with content in delta.
llama-index-integrations/llms/llama-index-llms-asi/tests/test_llms_asi.py