Buckets:

download
raw
1.39 kB
"""Mapper protocol and attribute value types."""
from collections.abc import Sequence
from typing import Final
from typing_extensions import Protocol, runtime_checkable
from litellm.integrations.otel.model.payloads import (
GuardrailSpanData,
LLMCallSpanData,
MCPListToolsSpanData,
MCPToolCallSpanData,
ServiceSpanData,
)
AttrScalar: Final = str | bool | int | float
# Mirrors ``opentelemetry.util.types.AttributeValue`` (homogeneous sequences)
# without importing the SDK, so mappers stay OTel-free.
AttrValue = AttrScalar | Sequence[str] | Sequence[bool] | Sequence[int] | Sequence[float]
AttributeMap = dict[str, AttrValue]
# The closed set of span-data types the engine routes through the mapper chain.
# Server spans (PROXY_REQUEST + management routes) belong to the mounted FastAPI
# instrumentor, not the mapper chain.
SpanData = LLMCallSpanData | MCPToolCallSpanData | MCPListToolsSpanData | GuardrailSpanData | ServiceSpanData
@runtime_checkable
class AttributeMapper(Protocol):
"""Maps a typed span input to a flat dict of OTel span attributes.
One method per mapper, dispatched internally on the ``data`` type. The
engine calls this uniformly for every span kind — mappers that don't speak
a given type return ``{}``. This is why the engine contains no attribute keys.
"""
def map(self, data: SpanData) -> AttributeMap: ...

Xet Storage Details

Size:
1.39 kB
·
Xet hash:
2e08b29f7e5d6d059c0000227e6a5238ad0968940db816547d64811b2a6bcc33

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.