forked from phoenix/litellm-mirror
fix(utils.py): fix fix pydantic obj to schema creation for vertex en… (#6071)
* fix(utils.py): fix fix pydantic obj to schema creation for vertex endpoints Fixes https://github.com/BerriAI/litellm/issues/6027 * test(test_completion.pyu): skip test - avoid hitting gemini rate limits * fix(common_utils.py): fix ruff linting error
This commit is contained in:
parent
29da2d49d6
commit
49d8b2be46
3 changed files with 143 additions and 1 deletions
|
@ -1711,6 +1711,31 @@ def test_completion_perplexity_api():
|
|||
# test_completion_perplexity_api()
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason="too many requests. Hitting gemini rate limits. Convert to mock test."
|
||||
)
|
||||
def test_completion_pydantic_obj_2():
|
||||
from pydantic import BaseModel
|
||||
|
||||
litellm.set_verbose = True
|
||||
|
||||
class CalendarEvent(BaseModel):
|
||||
name: str
|
||||
date: str
|
||||
participants: list[str]
|
||||
|
||||
class EventsList(BaseModel):
|
||||
events: list[CalendarEvent]
|
||||
|
||||
messages = [
|
||||
{"role": "user", "content": "List important events from the 20th century."}
|
||||
]
|
||||
|
||||
response = litellm.completion(
|
||||
model="gemini/gemini-1.5-pro", messages=messages, response_format=EventsList
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="this test is flaky")
|
||||
def test_completion_perplexity_api_2():
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue