Packages
langchain
0.9.1
0.9.2
0.9.1
0.9.0
0.8.14
0.8.13
0.8.12
0.8.11
0.8.10
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.4.0-rc.3
0.4.0-rc.2
0.4.0-rc.1
0.4.0-rc.0
0.3.3
0.3.2
0.3.1
0.3.0
0.3.0-rc.2
0.3.0-rc.1
0.3.0-rc.0
0.2.0
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Elixir implementation of a LangChain style framework that lets Elixir projects integrate with and leverage LLMs.
Current section
Files
Jump to
Current section
Files
lib/open_telemetry/config.ex
defmodule LangChain.OpenTelemetry.Config do
@moduledoc """
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`.
"""
@type t :: %__MODULE__{
capture_input_messages: boolean(),
capture_output_messages: boolean(),
capture_tool_arguments: boolean(),
capture_tool_results: boolean(),
enable_metrics: boolean()
}
defstruct capture_input_messages: false,
capture_output_messages: false,
capture_tool_arguments: false,
capture_tool_results: false,
enable_metrics: true
@doc """
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}
"""
@spec new(keyword()) :: t()
def new(opts \\ []) do
struct!(__MODULE__, opts)
end
end