Skip to main content

OpenTelemetry GenAI Utils

Project description

Minimal Overview

Utility function to provide APIs and data types to ease instrumentation of Generative AI workloads using OpenTelemetry semantic conventions.

Example usage for LLM Invocation.

from opentelemetry.util.genai.handler import get_telemetry_handler
handler = get_telemetry_handler()
user_input = "Hello"
inv = LLMInvocation(request_model="gpt-4", provider="openai",
  input_messages=[InputMessage(role="user", parts=[Text(user_input)])])
handler.start_llm(inv)
# your code which actuall invokes llm here
# response = client.chat.completions.create(...)
# ....
inv.output_messages = [OutputMessage(role="assistant", parts=[Text("Hi!")], finish_reason="stop")]
handler.stop_llm(inv)

See the example in examples/agentic_example.py for a full agent + LLM invocation flow.

Further Documentation

For architecture, design rationale, and broader usage patterns please consult: * Core concepts, high-level usage and setup * README.packages.architecture.md – extensibility architecture & emitter pipeline design.

Those documents cover configuration (environment variables, content capture modes, evaluation emission, extensibility via entry points) and release/stability notes.

Support & Stability

GenAI semantic conventions are incubating.

License

Apache 2.0 (see LICENSE).

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

splunk_otel_util_genai-0.1.0.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

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

splunk_otel_util_genai-0.1.0-py3-none-any.whl (64.0 kB view details)

Uploaded Python 3

File details

Details for the file splunk_otel_util_genai-0.1.0.tar.gz.

File metadata

  • Download URL: splunk_otel_util_genai-0.1.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for splunk_otel_util_genai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1599398f3c76a293361e35298982bafc1ac2ad827e37f62a446b26713fbb2de0
MD5 dcce854641a9336b757abb191963630e
BLAKE2b-256 b715de9991d1fd853d4fd239ad8e9755a4b3994512e0d3d754b0c241eeacaa8f

See more details on using hashes here.

File details

Details for the file splunk_otel_util_genai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for splunk_otel_util_genai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc6e4fc4003cbc2cde70e4a24090402e7fbb1badf7d0869479366519273bf50c
MD5 4e67ffa92244ebf78c79c7f014ca3234
BLAKE2b-256 1501b22c1520284bd55707ad52760452cc5794a2edcd2697a5f3d9b09cc49dfb

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