test(test_streaming.py): add test to make sure role is not returned in middle chunks during streaming

This commit is contained in:
Krrish Dholakia
2024-02-01 09:55:56 -08:00
parent d46df34ff5
commit 874ebad31d
+1
View File
@@ -92,6 +92,7 @@ def validate_second_format(chunk):
for choice in chunk["choices"]:
assert isinstance(choice["index"], int), "'index' should be an integer."
assert "role" not in choice["delta"], "'role' should be a string."
# openai v1.0.0 returns content as None
assert (choice["finish_reason"] is None) or isinstance(
choice["finish_reason"], str