def test_bedrock_converse_integration_chat_with_empty_assistant_message(
    bedrock_converse_integration,
):
    """Test chat integration with empty assistant message in conversation history."""
    llm = bedrock_converse_integration
    messages = [
        ChatMessage(role=MessageRole.USER, content="Hello"),
        ChatMessage(role=MessageRole.ASSISTANT, content=""),
        ChatMessage(role=MessageRole.USER, content="Can you count to 3?"),
    ]

    response = llm.chat(messages)

    assert isinstance(response, ChatResponse)
    assert response.message.role == MessageRole.ASSISTANT
    assert isinstance(response.message.content, str)
    assert len(response.message.content) > 0
    assert any(num in response.message.content for num in ["1", "2", "3"])
Test chat integration with empty assistant message in conversation history.
llama-index-integrations/llms/llama-index-llms-bedrock-converse/tests/test_llms_bedrock_converse.py