From 68737c457cdb4d9684dadb0d473f5149b1116ccc Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2026 08:06:33 +0000 Subject: [PATCH] refactor: clean up fresh tech debt in otel baggage metadata, model budget limiter and batch line items Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/batches/batch_line_items.py | 2 +- litellm/integrations/otel/model/metadata.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/litellm/batches/batch_line_items.py b/litellm/batches/batch_line_items.py index 3d175b22b90..6db685c708c 100644 --- a/litellm/batches/batch_line_items.py +++ b/litellm/batches/batch_line_items.py @@ -25,7 +25,7 @@ from litellm.types.utils import ( BatchFileProvider: TypeAlias = Literal["openai", "azure", "vertex_ai", "hosted_vllm", "anthropic", "mistral"] -_VERTEX_AI_UNKNOWN_CUSTOM_ID: Final = "unknown" # what a Vertex AI batch row that carries no custom_id is read as +_VERTEX_AI_UNKNOWN_CUSTOM_ID: Final = "unknown" _LINE: Final = re.compile(rb"[^\n]+") diff --git a/litellm/integrations/otel/model/metadata.py b/litellm/integrations/otel/model/metadata.py index cbbb1a9f6d4..6f93f0cc6f5 100644 --- a/litellm/integrations/otel/model/metadata.py +++ b/litellm/integrations/otel/model/metadata.py @@ -36,7 +36,7 @@ model. They coincide on the SDK path, which is correct. from __future__ import annotations -from collections.abc import Callable, Iterator, Mapping +from collections.abc import Iterator, Mapping from dataclasses import dataclass, field from datetime import datetime from types import MappingProxyType @@ -132,7 +132,10 @@ class RequestIdentity: snapshot) is flattened to dotted keys so ``requester_metadata.`` resolves too. """ - get: Final[Callable[[str], object]] = lambda name: _AUTH_ATTRIBUTE.validate_python(getattr(auth, name, None)) # noqa: E731 + + def get(name: str) -> object: + return _AUTH_ATTRIBUTE.validate_python(getattr(auth, name, None)) + auth_meta: Final = tuple( (meta_key, str(value)) for meta_key, attr in (