From 62ad6f19b70d3f5da51b67c9695340351ee9c5ad Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 2 Feb 2024 16:51:42 -0800 Subject: [PATCH] fix(main.py): for health checks, don't use cached responses --- litellm/main.py | 3 +++ litellm/tests/test_completion.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index bf4132863d..a30d6a8e41 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -3259,6 +3259,9 @@ async def ahealth_check( organization=organization, ) else: + model_params["cache"] = { + "no-cache": True + } # don't used cached responses for making health check calls if mode == "embedding": model_params.pop("messages", None) model_params["input"] = input diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 034abbb807..b756f0d963 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -1694,6 +1694,25 @@ def test_completion_anyscale_api(): # test_completion_anyscale_api() +def test_completion_cohere(): + try: + # litellm.set_verbose=True + messages = [ + {"role": "system", "content": "You're a good bot"}, + { + "role": "user", + "content": "Hey", + }, + ] + response = completion( + model="command-nightly", + messages=messages, + ) + print(response) + except Exception as e: + pytest.fail(f"Error occurred: {e}") + + def test_azure_cloudflare_api(): litellm.set_verbose = True try: