async def test_astream_chat_with_api():
    """Test the async streaming chat method with real API call."""
    llm = OpenAIResponses(model="gpt-4o-mini")
    messages = [ChatMessage(role=MessageRole.USER, content="Count to 3")]

    response_gen = await llm.astream_chat(messages)
    responses = [resp async for resp in response_gen]

    assert len(responses) > 0
    assert all(r.message.role == MessageRole.ASSISTANT for r in responses)
    accumulated_content = "".join([r.delta for r in responses if r.delta is not None])
    assert len(accumulated_content) > 0, "Accumulated content should not be empty"
Test the async streaming chat method with real API call.
llama-index-integrations/llms/llama-index-llms-openai/tests/test_openai_responses.py