From 9c7a4fde873f0cb9854dfe02d5c87cf2b0ed234a Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 9 Jan 2024 10:34:36 +0530 Subject: [PATCH] (test) hosted - ollama catch timeouts --- litellm/tests/test_completion.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 67c5998a09e..80a51c480b5 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -744,18 +744,19 @@ def test_completion_openai_litellm_key(): def test_completion_ollama_hosted(): try: + litellm.request_timeout = 20 # give ollama 20 seconds to response litellm.set_verbose = True response = completion( model="ollama/phi", messages=messages, - max_tokens=10, - num_retries=3, - timeout=20, + max_tokens=2, api_base="https://test-ollama-endpoint.onrender.com", ) # Add any assertions here to check the response print(response) - except Timeout as e: + except openai.APITimeoutError as e: + print("got a timeout error. Passed ! ") + litellm.request_timeout = None pass except Exception as e: pytest.fail(f"Error occurred: {e}")