From efd1b0dc140e3ae1bf4244689d54d7676050f377 Mon Sep 17 00:00:00 2001 From: Yucheng He Date: Sun, 4 Oct 2026 03:26:39 -0700 Subject: [PATCH] fix(otel): annotate to_openai_dict as Mapping after the rebase onto main Main's type-discipline budget tightened since the branch point; the plain dict return annotation is the one violation the rebased branch adds. Callers only serialize the result, so the read-only view is accurate. --- litellm/integrations/otel/mappers/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/otel/mappers/utils.py b/litellm/integrations/otel/mappers/utils.py index cfaf9d51a8c..99fb5299334 100644 --- a/litellm/integrations/otel/mappers/utils.py +++ b/litellm/integrations/otel/mappers/utils.py @@ -21,7 +21,12 @@ class MessageToolCall: name: str | None arguments: str | None - def to_openai_dict(self) -> dict[str, object]: + def to_openai_dict(self) -> Mapping[str, object]: + """The OpenAI wire shape of this tool call. + + The runtime object is a plain dict (it is only ever JSON-serialized); + the ``Mapping`` return type marks it read-only to callers. + """ return { "id": self.id, "type": self.type,