mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(proxy): reset batch line-item flag when the setting is absent
Removing store_batch_line_items_in_callbacks from the DB general settings left the module flag at its previous value because the effect early-returned when the key was neither in the DB nor owned by YAML. The proxy owns the global, so an absent resolved value now writes False. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
4b6efef9de
commit
ed23e2e82d
2 changed files with 7 additions and 4 deletions
|
|
@ -7586,11 +7586,8 @@ class ProxyConfig:
|
|||
|
||||
async def _apply_batch_line_items_setting(self, db_values: Mapping[str, SettingsJsonValue]) -> None:
|
||||
key: Final = "store_batch_line_items_in_callbacks"
|
||||
if key not in db_values and not self.settings.owned_by_config(key):
|
||||
return
|
||||
value: Final = coerce_bool(self.settings.get(key))
|
||||
if value is not None:
|
||||
litellm.store_batch_line_items_in_callbacks = value if isinstance(value, bool) else bool(value)
|
||||
litellm.store_batch_line_items_in_callbacks = bool(value) if value is not None else False
|
||||
|
||||
async def _apply_cache_size_setting(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -7890,6 +7890,12 @@ async def test_update_general_settings_store_batch_line_items_in_callbacks():
|
|||
db_general_settings={"store_batch_line_items_in_callbacks": True}
|
||||
)
|
||||
assert litellm.store_batch_line_items_in_callbacks is False
|
||||
|
||||
proxy_config._yaml_general_settings_keys = set()
|
||||
litellm.store_batch_line_items_in_callbacks = True # test-quality-ok: seed the prior opt-in so its removal is observable
|
||||
with patch("litellm.proxy.proxy_server.general_settings", {}): # test-quality-ok: module-global seam
|
||||
await proxy_config._update_general_settings(db_general_settings={})
|
||||
assert litellm.store_batch_line_items_in_callbacks is False
|
||||
finally:
|
||||
litellm.store_batch_line_items_in_callbacks = saved_flag
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue