mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(proxy/utils.py): handle item not existing during batch updates
This commit is contained in:
parent
0752048b81
commit
81846ffdec
1 changed files with 7 additions and 2 deletions
|
@ -722,9 +722,14 @@ class PrismaClient:
|
||||||
data_json = self.jsonify_object(data=user.model_dump())
|
data_json = self.jsonify_object(data=user.model_dump())
|
||||||
except:
|
except:
|
||||||
data_json = self.jsonify_object(data=user.dict())
|
data_json = self.jsonify_object(data=user.dict())
|
||||||
batcher.litellm_usertable.update(
|
batcher.litellm_usertable.upsert(
|
||||||
where={"user_id": user.user_id}, # type: ignore
|
where={"user_id": user.user_id}, # type: ignore
|
||||||
data={**data_json}, # type: ignore
|
data={
|
||||||
|
"create": {**data_json}, # type: ignore
|
||||||
|
"update": {
|
||||||
|
**data_json # type: ignore
|
||||||
|
}, # just update user-specified values, if it already exists
|
||||||
|
},
|
||||||
)
|
)
|
||||||
await batcher.commit()
|
await batcher.commit()
|
||||||
verbose_proxy_logger.info(
|
verbose_proxy_logger.info(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue