mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
test_basic_openai_responses_api_streaming_with_logging
This commit is contained in:
parent
9b6a4c2650
commit
89157f4b5c
1 changed files with 4 additions and 4 deletions
|
|
@ -93,25 +93,25 @@ def validate_standard_logging_payload(
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_basic_openai_responses_api_streaming_with_logging():
|
||||
def test_basic_openai_responses_api_streaming_with_logging():
|
||||
litellm._turn_on_debug()
|
||||
litellm.set_verbose = True
|
||||
test_custom_logger = TestCustomLogger()
|
||||
litellm.callbacks = [test_custom_logger]
|
||||
request_model = "gpt-4o"
|
||||
response = await litellm.aresponses(
|
||||
response = litellm.responses(
|
||||
model=request_model,
|
||||
input="hi",
|
||||
stream=True,
|
||||
)
|
||||
final_response: Optional[ResponseCompletedEvent] = None
|
||||
async for event in response:
|
||||
for event in response:
|
||||
if event.type == "response.completed":
|
||||
final_response = event
|
||||
print("litellm response=", json.dumps(event, indent=4, default=str))
|
||||
|
||||
print("sleeping for 2 seconds...")
|
||||
await asyncio.sleep(4)
|
||||
time.sleep(2)
|
||||
print(
|
||||
"standard logging payload=",
|
||||
json.dumps(test_custom_logger.standard_logging_object, indent=4, default=str),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue