mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
always json.dumps action_args for Prisma Json column
Prisma rejects bare None on Json? columns. Switch _serialize_json_for_prisma to json.dumps unconditionally — None becomes the string "null", which Postgres jsonb accepts as JSON null and prisma-client-python deserialises back to None on read. Mirrors the pattern in memory_endpoints._serialize_metadata_for_prisma. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e871514c1b
commit
cb51e0438e
1 changed files with 3 additions and 5 deletions
|
|
@ -15,16 +15,14 @@ from typing import Any, Dict, List, Optional
|
|||
from litellm.proxy.scheduled_tasks.schedule import compute_next_run
|
||||
|
||||
|
||||
def _serialize_json_for_prisma(value: Any) -> Optional[str]:
|
||||
def _serialize_json_for_prisma(value: Any) -> str:
|
||||
"""
|
||||
Encode a value bound for a Prisma `Json?` column. prisma-client-python
|
||||
rejects raw Python dicts/lists on Json columns
|
||||
rejects raw Python dicts/lists/None on Json columns
|
||||
(`MissingRequiredValueError` / `DataError`); always json.dumps so the
|
||||
driver hands a string to Postgres jsonb. Read path round-trips back
|
||||
to native Python.
|
||||
to native Python (`null` → None, `{}` → {}, etc).
|
||||
"""
|
||||
if value is None:
|
||||
return None
|
||||
return json.dumps(value)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue