From c2c186eb2863c43ccd6f205b5cf9220f2fd376b0 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Fri, 10 Nov 2023 17:34:40 -0800 Subject: [PATCH] (test) add gpt-4 vision --- litellm/tests/test_completion.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 1efd489e831..a65ab23bbb2 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -113,6 +113,36 @@ def test_completion_gpt4_turbo(): pytest.fail(f"Error occurred: {e}") # test_completion_gpt4_turbo() +def test_completion_gpt4_vision(): + try: + response = completion( + model="gpt-4-vision-preview", + messages=[ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What’s 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(response) + except openai.error.RateLimitError: + print("got a rate liimt error") + pass + except Exception as e: + pytest.fail(f"Error occurred: {e}") +# test_completion_gpt4_turbo() + def test_completion_perplexity_api(): try: # litellm.set_verbose=True