mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix(proxy): use class identity for signature cache key
Key the _CALLBACK_ACCEPTS_CALL_INFO cache by id(type(cb)) instead of id(cb) to avoid stale entries from Python address reuse after GC. All instances of the same callback class share the same method signature, so class identity is both safer and more cache-efficient.
This commit is contained in:
parent
f24dc09774
commit
6898b88439
1 changed files with 1 additions and 1 deletions
|
|
@ -292,7 +292,7 @@ _CALLBACK_ACCEPTS_CALL_INFO: Dict[int, bool] = {}
|
|||
|
||||
|
||||
def _accepts_litellm_call_info(cb: CustomLogger) -> bool:
|
||||
key = id(cb)
|
||||
key = id(type(cb))
|
||||
if key not in _CALLBACK_ACCEPTS_CALL_INFO:
|
||||
sig = inspect.signature(cb.async_post_call_response_headers_hook)
|
||||
_CALLBACK_ACCEPTS_CALL_INFO[key] = "litellm_call_info" in sig.parameters
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue