GenAI span attributes with Anthropic's own (Effect's
AnthropicTelemetry): the shared gen_ai.* groups and
gen_ai.anthropic.request.* / gen_ai.anthropic.response.*.
Classes#
Functions#
add_gen_ai_annotations#
add_gen_ai_annotations(span, options) -> NoneWrite the shared groups, then Anthropic's.
| Parameter | Type | Description |
|---|---|---|
span | Span | |
options | AnthropicTelemetryAttributeOptions |
def add_gen_ai_annotations(span: Span, options: AnthropicTelemetryAttributeOptions) -> None:
"""Write the shared groups, then Anthropic's."""
T.add_gen_ai_annotations(span, options)
anthropic = options.get("anthropic")
if anthropic is None:
return
request = anthropic.get("request")
if request is not None:
T.add_span_attributes(span, "gen_ai.anthropic.request", request)
response = anthropic.get("response")
if response is not None:
T.add_span_attributes(span, "gen_ai.anthropic.response", response)