mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
(test) router: acompletion + caching
This commit is contained in:
parent
02464f6661
commit
ba9dbbe6d5
1 changed files with 5 additions and 3 deletions
|
@ -83,7 +83,7 @@ def test_multiple_deployments():
|
|||
# Check results
|
||||
|
||||
|
||||
test_multiple_deployments()
|
||||
# test_multiple_deployments()
|
||||
|
||||
def test_exception_raising():
|
||||
# this tests if the router raises an exception when invalid params are set
|
||||
|
@ -237,7 +237,7 @@ def test_function_calling():
|
|||
|
||||
def test_acompletion_on_router():
|
||||
try:
|
||||
litellm.set_verbose = True
|
||||
litellm.set_verbose = False
|
||||
model_list = [
|
||||
{
|
||||
"model_name": "gpt-3.5-turbo",
|
||||
|
@ -262,7 +262,7 @@ def test_acompletion_on_router():
|
|||
]
|
||||
|
||||
messages = [
|
||||
{"role": "user", "content": f"What is the weather like in Boston {time.time()}?"}
|
||||
{"role": "user", "content": f"write a one sentence poem {time.time()}?"}
|
||||
]
|
||||
start_time = time.time()
|
||||
router = Router(model_list=model_list,
|
||||
|
@ -278,6 +278,8 @@ def test_acompletion_on_router():
|
|||
response2 = await router.acompletion(model="gpt-3.5-turbo", messages=messages)
|
||||
print(f"response2: {response2}")
|
||||
assert response1.id == response2.id
|
||||
assert len(response1.choices[0].message.content) > 0
|
||||
assert response1.choices[0].message.content == response2.choices[0].message.content
|
||||
asyncio.run(get_response())
|
||||
except litellm.Timeout as e:
|
||||
end_time = time.time()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue