(docs) fix exception mapping

This commit is contained in:
ishaan-jaff 2023-11-21 14:04:27 -08:00
parent e4f1e2b138
commit 34886a99cc

View file

@ -44,7 +44,8 @@ except openai.APITimeoutError as e:
## Usage - Catching Streaming Exceptions ## Usage - Catching Streaming Exceptions
```python ```python
import litellm import litellm
response = litellm.completion( try:
response = litellm.completion(
model="gpt-3.5-turbo", model="gpt-3.5-turbo",
messages=[ messages=[
{ {
@ -54,8 +55,8 @@ response = litellm.completion(
], ],
timeout=0.0001, # this will raise an exception timeout=0.0001, # this will raise an exception
stream=True, stream=True,
) )
for chunk in response: for chunk in response:
print(chunk) print(chunk)
except openai.APITimeoutError as e: except openai.APITimeoutError as e:
print("Passed: Raised correct exception. Got openai.APITimeoutError\nGood Job", e) print("Passed: Raised correct exception. Got openai.APITimeoutError\nGood Job", e)