feat(openai): add unit test for streaming error in _generate (#33134)

This commit is contained in:
Ali Ismail
2025-10-21 12:08:37 -07:00
committed by GitHub
parent 84dbebac4f
commit 5acd34ae92

View File

@@ -108,3 +108,13 @@ def test_stream_response_to_generation_chunk() -> None:
assert chunk == GenerationChunk(
text="", generation_info={"finish_reason": None, "logprobs": None}
)
def test_generate_streaming_multiple_prompts_error() -> None:
"""Ensures ValueError when streaming=True and multiple prompts."""
llm = OpenAI(streaming=True)
with pytest.raises(
ValueError, match="Cannot stream results with multiple prompts\\."
):
llm._generate(["foo", "bar"])