From 5829227d863f4c63bc4cd76f011fe1500706426f Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 5 Dec 2023 12:53:52 -0800 Subject: [PATCH] (test) router streaming + azure --- litellm/tests/test_router.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_router.py b/litellm/tests/test_router.py index ae9a06c41f9..4c806291ae3 100644 --- a/litellm/tests/test_router.py +++ b/litellm/tests/test_router.py @@ -74,7 +74,8 @@ def test_exception_raising(): def test_reading_key_from_model_list(): - # this tests if the router raises an exception when invalid params are set + # [PROD TEST CASE] + # this tests if the router can read key from model list and make completion call, and completion + stream call. This is 90% of the router use case # DO NOT REMOVE THIS TEST. It's an IMP ONE. Speak to Ishaan, if you are tring to remove this litellm.set_verbose=False import openai @@ -112,6 +113,23 @@ def test_reading_key_from_model_list(): } ] ) + print("\n response", response) + + print("\n Testing streaming response") + response = router.completion( + model="gpt-3.5-turbo", + messages=[ + { + "role": "user", + "content": "hello this request will fail" + } + ], + stream=True + ) + for chunk in response: + if chunk is not None: + print(chunk) + print("\n Passed Streaming") os.environ["AZURE_API_KEY"] = old_api_key router.reset() except Exception as e: