MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / content_size

Function content_size

tests/test_open_telemetry.py:279–282  ·  view source on GitHub ↗

The bytes of UTF-8 that the content attributes of `span` that can be reduced hold.

(span: ReadableSpan)

Source from the content-addressed store, hash-verified

277
278
279def content_size(span: ReadableSpan) -> int:
280 """The bytes of UTF-8 that the content attributes of `span` that can be reduced hold."""
281 names = ("gen_ai.input.messages", "gen_ai.output.messages", "gen_ai.system_instructions")
282 return sum(utf8_size(attributes(span).get(name, "")) for name in names)
283
284
285SYSTEM: Final = "gen_ai.system_instructions"

Calls 3

utf8_sizeFunction · 0.70
attributesFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected