| 99 | self.assertEqual(chunks[-1].choices[0].finish_reason, "stop") |
| 100 | |
| 101 | def test_content_is_streamed(self): |
| 102 | stream = self.client.chat.completions.create( |
| 103 | model="test", |
| 104 | messages=[{"role": "user", "content": "Hello"}], |
| 105 | stream=True |
| 106 | ) |
| 107 | |
| 108 | contents = [] |
| 109 | for chunk in stream: |
| 110 | if chunk.choices and chunk.choices[0].delta.content: |
| 111 | contents.append(chunk.choices[0].delta.content) |
| 112 | |
| 113 | self.assertGreater(len(contents), 0) |
| 114 | |
| 115 | def test_non_streaming(self): |
| 116 | resp = self.client.chat.completions.create( |