mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
feat(openai): add unit test for streaming error in _generate (#33134)
This commit is contained in:
@@ -108,3 +108,13 @@ def test_stream_response_to_generation_chunk() -> None:
|
|||||||
assert chunk == GenerationChunk(
|
assert chunk == GenerationChunk(
|
||||||
text="", generation_info={"finish_reason": None, "logprobs": None}
|
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"])
|
||||||
|
|||||||
Reference in New Issue
Block a user