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.4.tar.gz.

File metadata

File hashes

Hashes for splunk_otel_util_genai_translator_langsmith-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d2bc79f08d535e76c66a5c071549c6f2a734a8cf7b058b20086ece285a0ca874
MD5 19cf10cb73c26f515a34c59f1b78daa9
BLAKE2b-256 c5bf657cdaf520cec6711d0e9e501e04483634a6acc497ce0538a9a5d34b2471

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for splunk_otel_util_genai_translator_langsmith-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e55ed79e4dd015d7e60a1566c40231d332e53e8c89490f67d0634db573a09ff
MD5 6efc59b8cf93c46362c605f8dac196b5
BLAKE2b-256 d0efa27f5050b61a96f79e8efa05b9ff3971a7c56b18e1eec4feebbcad2d3386

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