mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Litellm router code coverage 3 (#6274)
* refactor(router.py): move assistants api endpoints to using 1 pass-through factory function Reduces code, increases testing coverage * refactor(router.py): reduce _common_check_available_deployment function size make code more maintainable - reduce possible errors * test(router_code_coverage.py): include batch_utils + pattern matching in enforced 100% code coverage Improves reliability * fix(router.py): fix model id match model dump
This commit is contained in:
parent
891e9001b5
commit
e22e8d24ef
8 changed files with 407 additions and 244 deletions
|
@ -2569,6 +2569,15 @@ async def test_router_batch_endpoints(provider):
|
|||
)
|
||||
print("Response from creating file=", file_obj)
|
||||
|
||||
## TEST 2 - test underlying create_file function
|
||||
file_obj = await router._acreate_file(
|
||||
model="my-custom-name",
|
||||
file=open(file_path, "rb"),
|
||||
purpose="batch",
|
||||
custom_llm_provider=provider,
|
||||
)
|
||||
print("Response from creating file=", file_obj)
|
||||
|
||||
await asyncio.sleep(10)
|
||||
batch_input_file_id = file_obj.id
|
||||
assert (
|
||||
|
@ -2583,6 +2592,15 @@ async def test_router_batch_endpoints(provider):
|
|||
custom_llm_provider=provider,
|
||||
metadata={"key1": "value1", "key2": "value2"},
|
||||
)
|
||||
## TEST 2 - test underlying create_batch function
|
||||
create_batch_response = await router._acreate_batch(
|
||||
model="my-custom-name",
|
||||
completion_window="24h",
|
||||
endpoint="/v1/chat/completions",
|
||||
input_file_id=batch_input_file_id,
|
||||
custom_llm_provider=provider,
|
||||
metadata={"key1": "value1", "key2": "value2"},
|
||||
)
|
||||
|
||||
print("response from router.create_batch=", create_batch_response)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue