working e2e tests for responses api

This commit is contained in:
Ishaan Jaff
2025-03-13 15:17:47 -07:00
parent 08f4a6844b
commit e9f3d97eb0
@@ -44,20 +44,20 @@ def validate_stream_chunk(chunk):
def test_basic_response():
client = get_test_client()
response = client.responses.create(
model="gpt-4", input="Tell me a three sentence bedtime story about a unicorn."
model="gpt-4o", input="just respond with the word 'ping'"
)
validate_response(response)
print("basic response=", response)
def test_streaming_response():
client = get_test_client()
stream = client.responses.create(
model="gpt-4", input="Tell me a story", stream=True
model="gpt-4o", input="just respond with the word 'ping'", stream=True
)
collected_chunks = []
for chunk in stream:
validate_stream_chunk(chunk)
print("stream chunk=", chunk)
collected_chunks.append(chunk)
assert len(collected_chunks) > 0