From e527137bee7719f9190fcb71fc94b9b1b19043de Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 16 Dec 2023 18:58:31 +0530 Subject: [PATCH] (test) gemini-pro-vision --- .../tests/test_amazing_vertex_completion.py | 112 +++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py index dc6ab3a7e4e..38d51352911 100644 --- a/litellm/tests/test_amazing_vertex_completion.py +++ b/litellm/tests/test_amazing_vertex_completion.py @@ -222,4 +222,114 @@ def test_gemini_pro_vision(): import traceback traceback.print_exc() raise e -test_gemini_pro_vision() \ No newline at end of file +# test_gemini_pro_vision() + + +# Extra gemini Vision tests for completion + stream, async, async + stream +# if we run into issues with gemini, we will also add these to our ci/cd pipeline +# def test_gemini_pro_vision_stream(): +# try: +# litellm.set_verbose = False +# litellm.num_retries=0 +# print("streaming response from gemini-pro-vision") +# resp = litellm.completion( +# model = "vertex_ai/gemini-pro-vision", +# messages=[ +# { +# "role": "user", +# "content": [ +# { +# "type": "text", +# "text": "Whats in this image?" +# }, +# { +# "type": "image_url", +# "image_url": { +# "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" +# } +# } +# ] +# } +# ], +# stream=True +# ) +# print(resp) +# for chunk in resp: +# print(chunk) +# except Exception as e: +# import traceback +# traceback.print_exc() +# raise e +# test_gemini_pro_vision_stream() + +# def test_gemini_pro_vision_async(): +# try: +# litellm.set_verbose = True +# litellm.num_retries=0 +# async def test(): +# resp = await litellm.acompletion( +# model = "vertex_ai/gemini-pro-vision", +# messages=[ +# { +# "role": "user", +# "content": [ +# { +# "type": "text", +# "text": "Whats in this image?" +# }, +# { +# "type": "image_url", +# "image_url": { +# "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" +# } +# } +# ] +# } +# ], +# ) +# print("async response gemini pro vision") +# print(resp) +# asyncio.run(test()) +# except Exception as e: +# import traceback +# traceback.print_exc() +# raise e +# test_gemini_pro_vision_async() + + +# def test_gemini_pro_vision_async_stream(): +# try: +# litellm.set_verbose = True +# litellm.num_retries=0 +# async def test(): +# resp = await litellm.acompletion( +# model = "vertex_ai/gemini-pro-vision", +# messages=[ +# { +# "role": "user", +# "content": [ +# { +# "type": "text", +# "text": "Whats in this image?" +# }, +# { +# "type": "image_url", +# "image_url": { +# "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" +# } +# } +# ] +# } +# ], +# stream=True +# ) +# print("async response gemini pro vision") +# print(resp) +# for chunk in resp: +# print(chunk) +# asyncio.run(test()) +# except Exception as e: +# import traceback +# traceback.print_exc() +# raise e +# test_gemini_pro_vision_async() \ No newline at end of file