forked from phoenix/litellm-mirror
raise cohere, vertex, tenacity import errors
This commit is contained in:
parent
0cc561bc5d
commit
1c9169e563
1 changed files with 4 additions and 4 deletions
|
@ -484,7 +484,7 @@ def completion(
|
||||||
try:
|
try:
|
||||||
import cohere
|
import cohere
|
||||||
except:
|
except:
|
||||||
Exception("Cohere import failed please run `pip install cohere`")
|
raise Exception("Cohere import failed please run `pip install cohere`")
|
||||||
|
|
||||||
cohere_key = (
|
cohere_key = (
|
||||||
api_key
|
api_key
|
||||||
|
@ -587,7 +587,7 @@ def completion(
|
||||||
try:
|
try:
|
||||||
import vertexai
|
import vertexai
|
||||||
except:
|
except:
|
||||||
Exception("vertexai import failed please run `pip install google-cloud-aiplatform`")
|
raise Exception("vertexai import failed please run `pip install google-cloud-aiplatform`")
|
||||||
from vertexai.preview.language_models import ChatModel, InputOutputTextPair
|
from vertexai.preview.language_models import ChatModel, InputOutputTextPair
|
||||||
|
|
||||||
vertexai.init(
|
vertexai.init(
|
||||||
|
@ -618,7 +618,7 @@ def completion(
|
||||||
try:
|
try:
|
||||||
import vertexai
|
import vertexai
|
||||||
except:
|
except:
|
||||||
Exception("vertexai import failed please run `pip install google-cloud-aiplatform`")
|
raise Exception("vertexai import failed please run `pip install google-cloud-aiplatform`")
|
||||||
from vertexai.language_models import TextGenerationModel
|
from vertexai.language_models import TextGenerationModel
|
||||||
|
|
||||||
vertexai.init(
|
vertexai.init(
|
||||||
|
@ -835,7 +835,7 @@ def completion_with_retries(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
import tenacity
|
import tenacity
|
||||||
except:
|
except:
|
||||||
Exception("tenacity import failed please run `pip install tenacity`")
|
raise Exception("tenacity import failed please run `pip install tenacity`")
|
||||||
|
|
||||||
retryer = tenacity.Retrying(stop=tenacity.stop_after_attempt(3), reraise=True)
|
retryer = tenacity.Retrying(stop=tenacity.stop_after_attempt(3), reraise=True)
|
||||||
return retryer(completion, *args, **kwargs)
|
return retryer(completion, *args, **kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue