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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
803d5d5e720f3e057c64d935dfd46dc013784820715d996980cb5b79bb5774a3
|
|
| MD5 |
32f68c169cce03309899e65f562d2d79
|
|
| BLAKE2b-256 |
dc06869c18f22fa32d6db9ebbc5bd82f18614c379b726aa9770d1b2d20f9178c
|
File details
Details for the file opentelemetry_util_genai-0.2b0-py3-none-any.whl.
File metadata
- Download URL: opentelemetry_util_genai-0.2b0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06dc8664713f9cec216d7093585a1a5fbb5f6fb7a387f19430774a5028aaa30b
|
|
| MD5 |
fa3135dbd957be5486e39d2e11382834
|
|
| BLAKE2b-256 |
940d1dc4705e44540183ab603aa4e1b0e3f888e63156678192e8c64f42c782ed
|