fix test amazing vertex medlm

This commit is contained in:
Ishaan Jaff 2024-07-18 18:16:00 -07:00 committed by Krrish Dholakia
parent 946db012d4
commit f8bdfe7cc3

View file

@ -36,6 +36,20 @@ litellm.cache = None
user_message = "Write a short poem about the sky" user_message = "Write a short poem about the sky"
messages = [{"content": user_message, "role": "user"}] messages = [{"content": user_message, "role": "user"}]
VERTEX_MODELS_TO_NOT_TEST = [
"medlm-medium",
"medlm-large",
"code-gecko",
"code-gecko@001",
"code-gecko@002",
"code-gecko@latest",
"codechat-bison@latest",
"code-bison@001",
"text-bison@001",
"gemini-1.5-pro",
"gemini-1.5-pro-preview-0215",
]
def get_vertex_ai_creds_json() -> dict: def get_vertex_ai_creds_json() -> dict:
# Define the path to the vertex_key.json file # Define the path to the vertex_key.json file
@ -327,17 +341,7 @@ def test_vertex_ai():
test_models += litellm.vertex_language_models # always test gemini-pro test_models += litellm.vertex_language_models # always test gemini-pro
for model in test_models: for model in test_models:
try: try:
if model in [ if model in VERTEX_MODELS_TO_NOT_TEST or (
"code-gecko",
"code-gecko@001",
"code-gecko@002",
"code-gecko@latest",
"codechat-bison@latest",
"code-bison@001",
"text-bison@001",
"gemini-1.5-pro",
"gemini-1.5-pro-preview-0215",
] or (
"gecko" in model or "32k" in model or "ultra" in model or "002" in model "gecko" in model or "32k" in model or "ultra" in model or "002" in model
): ):
# our account does not have access to this model # our account does not have access to this model
@ -382,17 +386,7 @@ def test_vertex_ai_stream():
test_models += litellm.vertex_language_models # always test gemini-pro test_models += litellm.vertex_language_models # always test gemini-pro
for model in test_models: for model in test_models:
try: try:
if model in [ if model in VERTEX_MODELS_TO_NOT_TEST or (
"code-gecko",
"code-gecko@001",
"code-gecko@002",
"code-gecko@latest",
"codechat-bison@latest",
"code-bison@001",
"text-bison@001",
"gemini-1.5-pro",
"gemini-1.5-pro-preview-0215",
] or (
"gecko" in model or "32k" in model or "ultra" in model or "002" in model "gecko" in model or "32k" in model or "ultra" in model or "002" in model
): ):
# our account does not have access to this model # our account does not have access to this model
@ -437,17 +431,9 @@ async def test_async_vertexai_response():
test_models += litellm.vertex_language_models # always test gemini-pro test_models += litellm.vertex_language_models # always test gemini-pro
for model in test_models: for model in test_models:
print(f"model being tested in async call: {model}") print(f"model being tested in async call: {model}")
if model in [ if model in VERTEX_MODELS_TO_NOT_TEST or (
"code-gecko", "gecko" in model or "32k" in model or "ultra" in model or "002" in model
"code-gecko@001", ):
"code-gecko@002",
"code-gecko@latest",
"codechat-bison@latest",
"code-bison@001",
"text-bison@001",
"gemini-1.5-pro",
"gemini-1.5-pro-preview-0215",
] or ("gecko" in model or "32k" in model or "ultra" in model or "002" in model):
# our account does not have access to this model # our account does not have access to this model
continue continue
try: try:
@ -484,17 +470,9 @@ async def test_async_vertexai_streaming_response():
test_models = random.sample(test_models, 1) test_models = random.sample(test_models, 1)
test_models += litellm.vertex_language_models # always test gemini-pro test_models += litellm.vertex_language_models # always test gemini-pro
for model in test_models: for model in test_models:
if model in [ if model in VERTEX_MODELS_TO_NOT_TEST or (
"code-gecko", "gecko" in model or "32k" in model or "ultra" in model or "002" in model
"code-gecko@001", ):
"code-gecko@002",
"code-gecko@latest",
"codechat-bison@latest",
"code-bison@001",
"text-bison@001",
"gemini-1.5-pro",
"gemini-1.5-pro-preview-0215",
] or ("gecko" in model or "32k" in model or "ultra" in model or "002" in model):
# our account does not have access to this model # our account does not have access to this model
continue continue
try: try: