MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / test_streaming

Function test_streaming

tests/test_api_compatibility.py:91–108  ·  view source on GitHub ↗

Test streaming response

(client)

Source from the content-addressed store, hash-verified

89
90
91def 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
111def test_reasoning_tokens_in_response(client):

Callers

nothing calls this directly

Calls 1

createMethod · 0.45

Tested by

no test coverage detected