OpenTelemetryEmbeddingGeneratorBuilderExtensions.UseOpenTelemetry<TInput,TEmbedding> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds OpenTelemetry support to the embedding generator pipeline, following the OpenTelemetry Semantic Conventions for Generative AI systems.
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> UseOpenTelemetry<TInput,TEmbedding> (this Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> builder, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, string? sourceName = default, Action<Microsoft.Extensions.AI.OpenTelemetryEmbeddingGenerator<TInput,TEmbedding>>? configure = default) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member UseOpenTelemetry : Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> * Microsoft.Extensions.Logging.ILoggerFactory * string * Action<Microsoft.Extensions.AI.OpenTelemetryEmbeddingGenerator<'Input, 'Embedding>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)
<Extension()>
Public Function UseOpenTelemetry(Of TInput, TEmbedding) (builder As EmbeddingGeneratorBuilder(Of TInput, TEmbedding), Optional loggerFactory As ILoggerFactory = Nothing, Optional sourceName As String = Nothing, Optional configure As Action(Of OpenTelemetryEmbeddingGenerator(Of TInput, TEmbedding)) = Nothing) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)
Type Parameters
- TInput
The type of input used to produce embeddings.
- TEmbedding
The type of embedding generated.
Parameters
- loggerFactory
- ILoggerFactory
An optional ILoggerFactory to use to create a logger for logging events.
- sourceName
- String
An optional source name that will be used on the telemetry data.
- configure
- Action<OpenTelemetryEmbeddingGenerator<TInput,TEmbedding>>
An optional callback that can be used to configure the OpenTelemetryEmbeddingGenerator<TInput,TEmbedding> instance.
Returns
The builder
.
Remarks
The draft specification this follows is available at https://opentelemetry.io/docs/specs/semconv/gen-ai/. The specification is still experimental and subject to change; as such, the telemetry output by this generator is also subject to change.