mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
Litellm add managed files db (#9930)
* fix(openai.py): ensure openai file object shows up on logs * fix(managed_files.py): return unified file id as b64 str allows retrieve file id to work as expected * fix(managed_files.py): apply decoded file id transformation * fix: add unit test for file id + decode logic * fix: initial commit for litellm_proxy support with CRUD Endpoints * fix(managed_files.py): support retrieve file operation * fix(managed_files.py): support for DELETE endpoint for files * fix(managed_files.py): retrieve file content support supports retrieve file content api from openai * fix: fix linting error * test: update tests * fix: fix linting error * feat(managed_files.py): support reading / writing files in DB * feat(managed_files.py): support deleting file from DB on delete * test: update testing * fix(spend_tracking_utils.py): ensure each file create request is logged correctly * fix(managed_files.py): fix storing / returning managed file object from cache * fix(files/main.py): pass litellm params to azure route * test: fix test * build: add new prisma migration * build: bump requirements * test: add more testing * refactor: cleanup post merge w/ main * fix: fix code qa errors
This commit is contained in:
parent
93037ea4d3
commit
421e0a3004
19 changed files with 286 additions and 158 deletions
|
@ -16,7 +16,7 @@ from litellm.proxy.hooks.managed_files import _PROXY_LiteLLMManagedFiles
|
|||
from litellm.types.utils import SpecialEnums
|
||||
|
||||
|
||||
def test_get_file_ids_and_decode_b64_to_unified_uid_from_messages():
|
||||
def test_get_file_ids_from_messages():
|
||||
proxy_managed_files = _PROXY_LiteLLMManagedFiles(
|
||||
DualCache(), prisma_client=MagicMock()
|
||||
)
|
||||
|
@ -34,20 +34,11 @@ def test_get_file_ids_and_decode_b64_to_unified_uid_from_messages():
|
|||
],
|
||||
},
|
||||
]
|
||||
file_ids = (
|
||||
proxy_managed_files.get_file_ids_and_decode_b64_to_unified_uid_from_messages(
|
||||
messages
|
||||
)
|
||||
)
|
||||
file_ids = proxy_managed_files.get_file_ids_from_messages(messages)
|
||||
assert file_ids == [
|
||||
"litellm_proxy:application/pdf;unified_id,fc7f2ea5-0f50-49f6-89c1-7e6a54b12138"
|
||||
"bGl0ZWxsbV9wcm94eTphcHBsaWNhdGlvbi9wZGY7dW5pZmllZF9pZCxmYzdmMmVhNS0wZjUwLTQ5ZjYtODljMS03ZTZhNTRiMTIxMzg"
|
||||
]
|
||||
|
||||
## in place update
|
||||
assert messages[0]["content"][1]["file"]["file_id"].startswith(
|
||||
SpecialEnums.LITELM_MANAGED_FILE_ID_PREFIX.value
|
||||
)
|
||||
|
||||
|
||||
# def test_list_managed_files():
|
||||
# proxy_managed_files = _PROXY_LiteLLMManagedFiles(DualCache())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue