From 34886a99cc20590eef4ae006eadcec0ed42edf63 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 21 Nov 2023 14:04:27 -0800 Subject: [PATCH] (docs) fix exception mapping --- docs/my-website/docs/exception_mapping.md | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/my-website/docs/exception_mapping.md b/docs/my-website/docs/exception_mapping.md index 15e2cac76..7297ddb90 100644 --- a/docs/my-website/docs/exception_mapping.md +++ b/docs/my-website/docs/exception_mapping.md @@ -44,19 +44,20 @@ except openai.APITimeoutError as e: ## Usage - Catching Streaming Exceptions ```python import litellm -response = litellm.completion( - model="gpt-3.5-turbo", - messages=[ - { - "role": "user", - "content": "hello, write a 20 pg essay" - } - ], - timeout=0.0001, # this will raise an exception - stream=True, -) -for chunk in response: - print(chunk) +try: + response = litellm.completion( + model="gpt-3.5-turbo", + messages=[ + { + "role": "user", + "content": "hello, write a 20 pg essay" + } + ], + timeout=0.0001, # this will raise an exception + stream=True, + ) + for chunk in response: + print(chunk) except openai.APITimeoutError as e: print("Passed: Raised correct exception. Got openai.APITimeoutError\nGood Job", e) print(type(e))