Files
litellm/litellm
ryan-crabbeandGitHub 8c7051686b perf: optimize get_standard_logging_metadata with set intersection (#19685)
* perf: Optimize get_standard_logging_metadata with set intersection

- Cache StandardLoggingMetadata.__annotations__.keys() as module-level frozenset
- Use set intersection to iterate only keys present in both metadata and supported keys
- Single lookup for user_api_key instead of 3 separate .get() calls

Results:
- get_standard_logging_metadata: 1.55s → 1.41s (9.2% faster)

* test: add unit tests for get_standard_logging_metadata non-string user_api_key handling
2026-02-07 09:35:03 -08:00
..