Test streaming response
(client)
| 89 | |
| 90 | |
| 91 | def test_streaming(client): |
| 92 | """Test streaming response""" |
| 93 | stream = client.chat.completions.create( |
| 94 | model=TEST_MODEL, |
| 95 | messages=[ |
| 96 | {"role": "user", "content": "Count from 1 to 5"} |
| 97 | ], |
| 98 | stream=True, |
| 99 | max_tokens=50 |
| 100 | ) |
| 101 | |
| 102 | chunks = list(stream) |
| 103 | assert len(chunks) > 0 |
| 104 | # First chunk should have role |
| 105 | assert chunks[0].choices[0].delta.role == "assistant" |
| 106 | # Later chunks should have content |
| 107 | content_chunks = [chunk.choices[0].delta.content for chunk in chunks if chunk.choices[0].delta.content] |
| 108 | assert len(content_chunks) > 0 |
| 109 | |
| 110 | |
| 111 | def test_reasoning_tokens_in_response(client): |