From 8a4a14cc95df7cb99745fb17110fe69ae1fb8ee8 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 5 Mar 2024 21:12:50 -0800 Subject: [PATCH] test(test_caching.py): fix test to check on id --- litellm/tests/test_caching.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/litellm/tests/test_caching.py b/litellm/tests/test_caching.py index f649bff027..0e5a7ab5f6 100644 --- a/litellm/tests/test_caching.py +++ b/litellm/tests/test_caching.py @@ -438,11 +438,10 @@ def test_redis_cache_completion_stream(): temperature=0.2, stream=True, ) - response_1_content = "" + response_1_id = "" for chunk in response1: print(chunk) - response_1_content += chunk.choices[0].delta.content or "" - print(response_1_content) + response_1_id = chunk.id time.sleep(0.5) response2 = completion( model="gpt-3.5-turbo", @@ -451,15 +450,13 @@ def test_redis_cache_completion_stream(): temperature=0.2, stream=True, ) - response_2_content = "" + response_2_id = "" for chunk in response2: print(chunk) - response_2_content += chunk.choices[0].delta.content or "" - print("\nresponse 1", response_1_content) - print("\nresponse 2", response_2_content) + response_2_id += chunk.id assert ( - response_1_content == response_2_content - ), f"Response 1 != Response 2. Same params, Response 1{response_1_content} != Response 2{response_2_content}" + response_1_id == response_2_id + ), f"Response 1 != Response 2. Same params, Response 1{response_1_id} != Response 2{response_2_id}" litellm.success_callback = [] litellm.cache = None litellm.success_callback = []