From bda1bd89aeef9d585cb3c99f0d7f7510338b0782 Mon Sep 17 00:00:00 2001 From: Moe Khalil Date: Sun, 20 Sep 2026 15:04:33 +0000 Subject: [PATCH] chore(auto-router): document mutable logging API boundaries Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../router_strategy/complexity_router/jev_classifier.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/router_strategy/complexity_router/jev_classifier.py b/litellm/router_strategy/complexity_router/jev_classifier.py index acaf19a5aba..ef613f8321d 100644 --- a/litellm/router_strategy/complexity_router/jev_classifier.py +++ b/litellm/router_strategy/complexity_router/jev_classifier.py @@ -126,8 +126,8 @@ class HttpJevClassifierClient: for key, value in TypeAdapter(Mapping[str, object]).validate_python(metadata).items() } ) - params: Final = { - "metadata": { + params: Final = { # mutable-ok: Logging's kwargs and litellm_params require dicts + "metadata": { # mutable-ok: Logging enriches metadata in place before dispatching callbacks **forwarded_internal_call_metadata(parent_metadata, AUTOROUTER_CLASSIFIER_CALL_ORIGIN), INTERNAL_CALL_ORIGIN_METADATA_KEY: AUTOROUTER_CLASSIFIER_CALL_ORIGIN, }, @@ -136,7 +136,7 @@ class HttpJevClassifierClient: } logging_obj: Final = Logging( model=f"typesafe/{request.model}", - messages=[{"role": "user", "content": request.state}], + messages=[{"role": "user", "content": request.state}], # mutable-ok: callbacks require JSON message lists stream=False, call_type="pass_through_endpoint", start_time=start_time, @@ -148,7 +148,7 @@ class HttpJevClassifierClient: logging_obj.update_environment_variables( model=f"typesafe/{request.model}", user=parent_user if isinstance(parent_user := parent.get("user"), str) else None, - optional_params={}, + optional_params={}, # mutable-ok: Logging's optional_params contract requires a dict litellm_params=params, ) normalized: Final = TypeSafePassthroughLoggingHandler.typesafe_passthrough_handler(