Skip to main content

OpenTelemetry GenAI Utils

Project description

The GenAI Utils package will include boilerplate and helpers to standardize instrumentation for Generative AI. This package will provide APIs and decorators to minimize the work needed to instrument genai libraries, while providing standardization for generating both types of otel, “spans and metrics” and “spans, metrics and events”

This package relies on environment variables to configure capturing of message content. By default, message content will not be captured. Set the environment variable OTEL_SEMCONV_STABILITY_OPT_IN to gen_ai_latest_experimental to enable experimental features. And set the environment variable OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to SPAN_ONLY or SPAN_AND_EVENT to capture message content in spans.

This package provides these span attributes:

  • gen_ai.provider.name: Str(openai)

  • gen_ai.operation.name: Str(chat)

  • gen_ai.request.model: Str(gpt-3.5-turbo)

  • gen_ai.response.finish_reasons: Slice([“stop”])

  • gen_ai.response.model: Str(gpt-3.5-turbo-0125)

  • gen_ai.response.id: Str(chatcmpl-Bz8yrvPnydD9pObv625n2CGBPHS13)

  • gen_ai.usage.input_tokens: Int(24)

  • gen_ai.usage.output_tokens: Int(7)

  • gen_ai.input.messages: Str(‘[{“role”: “Human”, “parts”: [{“content”: “hello world”, “type”: “text”}]}]’)

  • gen_ai.output.messages: Str(‘[{“role”: “AI”, “parts”: [{“content”: “hello back”, “type”: “text”}], “finish_reason”: “stop”}]’)

Installation

pip install opentelemetry-util-genai

Design Document

The design document for the OpenTelemetry GenAI Utils can be found at: Design Document

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentelemetry_util_genai-0.2b0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opentelemetry_util_genai-0.2b0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file opentelemetry_util_genai-0.2b0.tar.gz.

File metadata

  • Download URL: opentelemetry_util_genai-0.2b0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for opentelemetry_util_genai-0.2b0.tar.gz
Algorithm Hash digest
SHA256 803d5d5e720f3e057c64d935dfd46dc013784820715d996980cb5b79bb5774a3
MD5 32f68c169cce03309899e65f562d2d79
BLAKE2b-256 dc06869c18f22fa32d6db9ebbc5bd82f18614c379b726aa9770d1b2d20f9178c

See more details on using hashes here.

File details

Details for the file opentelemetry_util_genai-0.2b0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_util_genai-0.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 06dc8664713f9cec216d7093585a1a5fbb5f6fb7a387f19430774a5028aaa30b
MD5 fa3135dbd957be5486e39d2e11382834
BLAKE2b-256 940d1dc4705e44540183ab603aa4e1b0e3f888e63156678192e8c64f42c782ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page