forked from phoenix/litellm-mirror
refactor: move all testing to top-level of repo
Closes https://github.com/BerriAI/litellm/issues/486
This commit is contained in:
parent
5403c5828c
commit
3560f0ef2c
213 changed files with 74 additions and 217 deletions
39
tests/local_testing/test_google_ai_studio_gemini.py
Normal file
39
tests/local_testing/test_google_ai_studio_gemini.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
import os, sys, traceback
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../..")
|
||||
) # Adds the parent directory to the system path
|
||||
import litellm
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
def generate_text():
|
||||
try:
|
||||
litellm.set_verbose = True
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "What is this image?"},
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": "https://avatars.githubusercontent.com/u/17561003?v=4"
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
response = litellm.completion(
|
||||
model="gemini/gemini-pro-vision",
|
||||
messages=messages,
|
||||
stop="Hello world",
|
||||
num_retries=3,
|
||||
)
|
||||
print(response)
|
||||
assert isinstance(response.choices[0].message.content, str) == True
|
||||
except Exception as exception:
|
||||
raise Exception("An error occurred during text generation:", exception)
|
||||
|
||||
|
||||
# generate_text()
|
Loading…
Add table
Add a link
Reference in a new issue