Skip to main content

Langsmith -> GenAI translator emitter for OpenTelemetry GenAI

Project description

pypi

This package provides automatic translation of Langsmith-specific span attributes to OpenTelemetry GenAI semantic convention compliant format.

Overview

Langsmith is the observability platform for LangChain applications, providing tracing, evaluation, and monitoring capabilities. This translator bridges Langsmith’s attribute format to the standardized GenAI semantic conventions.

Installation

pip install splunk-otel-util-genai-translator-langsmith

Usage

The translator automatically enables when the package is installed. No additional configuration is required.

To explicitly enable or configure:

from opentelemetry.util.genai.langsmith import enable_langsmith_translator

# Enable with default configuration
enable_langsmith_translator()

# Enable with custom attribute transformations
enable_langsmith_translator(
    attribute_transformations={
        "rename": {
            "my.custom.attr": "gen_ai.custom.attr"
        }
    }
)

Disabling Auto-Enable

Set the environment variable OTEL_INSTRUMENTATION_GENAI_LANGSMITH_DISABLE=true to disable automatic registration.

Attribute Mappings

The translator performs the following attribute mappings:

Content & Messages

  • langsmith.entity.inputgen_ai.input.messages

  • langsmith.entity.outputgen_ai.output.messages

  • gen_ai.promptgen_ai.input.messages

  • gen_ai.completiongen_ai.output.messages

Model & System

  • langsmith.metadata.ls_providergen_ai.system

  • langsmith.metadata.ls_model_namegen_ai.request.model

  • langsmith.metadata.ls_model_typegen_ai.operation.name

Request Parameters

  • langsmith.metadata.ls_temperaturegen_ai.request.temperature

  • langsmith.metadata.ls_max_tokensgen_ai.request.max_tokens

  • langsmith.metadata.ls_top_pgen_ai.request.top_p

  • langsmith.metadata.ls_top_kgen_ai.request.top_k

Token Usage

  • langsmith.token_usage.prompt_tokensgen_ai.usage.input_tokens

  • langsmith.token_usage.completion_tokensgen_ai.usage.output_tokens

  • langsmith.token_usage.total_tokensgen_ai.usage.total_tokens

Tool Calling

  • langsmith.tool.namegen_ai.tool.call.name

  • langsmith.tool.idgen_ai.tool.call.id

  • langsmith.tool.argumentsgen_ai.tool.call.arguments

  • langsmith.tool.outputgen_ai.tool.call.result

Session & Run Tracking

  • langsmith.session_idgen_ai.conversation.id

  • langsmith.thread_idgen_ai.conversation.id

  • langsmith.run_idgen_ai.run.id

Known Limitations

  • Root agent/workflow span duplicates the full conversation. LangSmith serializes the entire MessagesState accumulator as the root span’s output, so gen_ai.output.messages on the top-level invoke_agent span contains every turn of the conversation rather than just the final reply. Child chat and nested agent spans carry the correct per-turn messages.

  • Agent vs. workflow classification depends on naming. LangSmith reports every orchestration span with run_type=chain regardless of whether it represents an agent or a higher-level workflow. The translator infers the intent from the span name: roots whose name contains agent or executor (or that already carry gen_ai.agent.name) are classified as invoke_agent; other root chains are classified as invoke_workflow; inner chains become step. To get correct classification, name your agents accordingly — e.g. create_agent(name="weather_agent") or compile(name="research_agent") for single-agent graphs, and a neutral name like compile(name="weather_assistant") for multi-agent workflows.

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

Built Distribution

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

File details

Details for the file splunk_otel_util_genai_translator_langsmith-0.1.5.tar.gz.

File metadata

  • Download URL: splunk_otel_util_genai_translator_langsmith-0.1.5.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"trixie","libc":{"lib":"glibc","version":"2.41"},"name":"Debian GNU/Linux","version":"13"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.5.6 7 Apr 2026","python":"3.11.15","system":{"name":"Linux","release":"5.15.0-1084-aws"}} HTTPX2/2.9.0

File hashes

Hashes for splunk_otel_util_genai_translator_langsmith-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c39d0701a35f5812bc0c03acb4eff08bdf3cad2e137ea1dce581bb1ab57d32ca
MD5 8ec9bb070e1e82883bb0346d1043002a
BLAKE2b-256 69b6a714a14500514a8f50f0e49d5bbb421db4b75e0fce3ac7a5cda041e6bc6b

See more details on using hashes here.

File details

Details for the file splunk_otel_util_genai_translator_langsmith-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: splunk_otel_util_genai_translator_langsmith-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"trixie","libc":{"lib":"glibc","version":"2.41"},"name":"Debian GNU/Linux","version":"13"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.5.6 7 Apr 2026","python":"3.11.15","system":{"name":"Linux","release":"5.15.0-1084-aws"}} HTTPX2/2.9.0

File hashes

Hashes for splunk_otel_util_genai_translator_langsmith-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e3f8346eac630b02835fece2899e45d45becd4f2eb4adce9bd0fb6d66394af81
MD5 7ca196a5fd74666ed1d8f5f67ab3a7d1
BLAKE2b-256 f4c2766abef78ef7afb7846f5bdb7ccff7b6849288c7f8401726de8ce859c776

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