LangChain.OpenTelemetry.Config (LangChain v0.9.0)

Copy Markdown View Source

Configuration for the LangChain OpenTelemetry integration.

Options

  • :capture_input_messages - When true, records gen_ai.input.messages as a span attribute containing the serialized input messages. Defaults to false.

  • :capture_output_messages - When true, records gen_ai.output.messages as a span attribute containing the serialized output messages. Defaults to false.

  • :capture_tool_arguments - When true, records gen_ai.tool.call.arguments as a span attribute. Defaults to false.

  • :capture_tool_results - When true, records gen_ai.tool.call.result as a span attribute. Defaults to false.

  • :enable_metrics - When true, attaches the metrics handler, which re-emits LangChain telemetry as intermediary [:langchain, :otel, …] metric events for a consumer (Telemetry.Metrics, PromEx, …) to record. It does not record OTel histograms directly. Defaults to true. See LangChain.OpenTelemetry.MetricsHandler.

Summary

Functions

Creates a new config from the given options.

Types

t()

@type t() :: %LangChain.OpenTelemetry.Config{
  capture_input_messages: boolean(),
  capture_output_messages: boolean(),
  capture_tool_arguments: boolean(),
  capture_tool_results: boolean(),
  enable_metrics: boolean()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new config from the given options.

Examples

iex> LangChain.OpenTelemetry.Config.new(capture_input_messages: true)
%LangChain.OpenTelemetry.Config{capture_input_messages: true}