mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-14 02:22:54 +00:00
working e2e tests for responses api
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user