mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 02:17:10 +00:00
fix(proxy): use prisma.Json for JSON fields in _rotate_master_key create_many
Prisma's create_many() requires JSON fields to be wrapped in prisma.Json() not passed as raw JSON strings. Lines 3099-3100 were using safe_dumps() (which returns str) instead of prisma.Json(), causing Prisma validation errors during master key rotation. This is consistent with the existing pattern in the same file (line 3134 already uses prisma.Json for litellm_config env vars). The regression test test_rotate_master_key_model_data_valid_for_prisma was already correctly asserting isinstance(..., prisma.Json) — the test exposed the mismatch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
c760318c79
commit
392bbf35b7
@@ -3096,8 +3096,8 @@ async def _rotate_master_key( # noqa: PLR0915
|
||||
)
|
||||
if new_model:
|
||||
_dumped = new_model.model_dump(exclude_none=True)
|
||||
_dumped["litellm_params"] = safe_dumps(_dumped["litellm_params"])
|
||||
_dumped["model_info"] = safe_dumps(_dumped["model_info"])
|
||||
_dumped["litellm_params"] = prisma.Json(_dumped["litellm_params"]) # type: ignore[attr-defined]
|
||||
_dumped["model_info"] = prisma.Json(_dumped["model_info"]) # type: ignore[attr-defined]
|
||||
new_models.append(_dumped)
|
||||
verbose_proxy_logger.debug("Resetting proxy model table")
|
||||
async with prisma_client.db.tx() as tx:
|
||||
|
||||
Reference in New Issue
Block a user