Skip to content

Commit 3c0d530

Browse files
committed
test_async_vertexai_response_basic
1 parent a188e5f commit 3c0d530

File tree

1 file changed

+22
-47
lines changed

1 file changed

+22
-47
lines changed

tests/local_testing/test_amazing_vertex_completion.py

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -387,58 +387,33 @@ def test_avertex_ai_stream():
387387

388388
@pytest.mark.flaky(retries=3, delay=1)
389389
@pytest.mark.asyncio
390-
async def test_async_vertexai_response():
391-
import random
390+
async def test_async_vertexai_response_basic():
392391

393392
load_vertex_ai_credentials()
394-
test_models = (
395-
litellm.vertex_chat_models
396-
| litellm.vertex_code_chat_models
397-
| litellm.vertex_text_models
398-
| litellm.vertex_code_text_models
399-
)
400-
401-
test_models = random.sample(list(test_models), 1)
402-
test_models += list(litellm.vertex_language_models) # always test gemini-pro
403-
for model in test_models:
404-
print(
405-
f"model being tested in async call: {model}, litellm.vertex_language_models: {litellm.vertex_language_models}"
393+
try:
394+
user_message = "Hello, how are you?"
395+
messages = [{"content": user_message, "role": "user"}]
396+
response = await acompletion(
397+
model="gemini-2.5-flash",
398+
messages=messages,
399+
temperature=0.7,
400+
timeout=5
406401
)
407-
if model in VERTEX_MODELS_TO_NOT_TEST or (
408-
"gecko" in model
409-
or "32k" in model
410-
or "ultra" in model
411-
or "002" in model
412-
or "gemini-2.0-flash-thinking-exp" in model
413-
or "gemini-2.0-pro-exp-02-05" in model
414-
or "gemini-pro" in model
415-
or "gemini-1.0-pro" in model
416-
or "image-generation" in model
417-
):
418-
# our account does not have access to this model
419-
continue
420-
try:
421-
user_message = "Hello, how are you?"
422-
messages = [{"content": user_message, "role": "user"}]
423-
response = await acompletion(
424-
model=model, messages=messages, temperature=0.7, timeout=5
425-
)
426-
print(f"response: {response}")
427-
except litellm.NotFoundError as e:
428-
pass
429-
except litellm.RateLimitError as e:
430-
pass
431-
except litellm.Timeout as e:
432-
pass
433-
except litellm.APIError as e:
434-
pass
435-
except litellm.InternalServerError as e:
436-
pass
437-
except Exception as e:
438-
pytest.fail(f"An exception occurred: {e}")
402+
print(f"response: {response}")
403+
except litellm.NotFoundError as e:
404+
pass
405+
except litellm.RateLimitError as e:
406+
pass
407+
except litellm.Timeout as e:
408+
pass
409+
except litellm.APIError as e:
410+
pass
411+
except litellm.InternalServerError as e:
412+
pass
413+
except Exception as e:
414+
pytest.fail(f"An exception occurred: {e}")
439415

440416

441-
# asyncio.run(test_async_vertexai_response())
442417

443418

444419
@pytest.mark.flaky(retries=3, delay=1)

0 commit comments

Comments
 (0)