Skip to content

Commit c01d681

Browse files
authored
Update OpenTelemetryChatClient to 1.34 (#6466)
1 parent 901e366 commit c01d681

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Extensions.AI;
2525

2626
/// <summary>Represents a delegating chat client that implements the OpenTelemetry Semantic Conventions for Generative AI systems.</summary>
2727
/// <remarks>
28-
/// This class provides an implementation of the Semantic Conventions for Generative AI systems v1.33, defined at <see href="https://opentelemetry.io/docs/specs/semconv/gen-ai/" />.
28+
/// This class provides an implementation of the Semantic Conventions for Generative AI systems v1.34, defined at <see href="https://opentelemetry.io/docs/specs/semconv/gen-ai/" />.
2929
/// The specification is still experimental and subject to change; as such, the telemetry output by this client is also subject to change.
3030
/// </remarks>
3131
public sealed partial class OpenTelemetryChatClient : DelegatingChatClient
@@ -247,6 +247,11 @@ public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA
247247

248248
if (options is not null)
249249
{
250+
if (options.ConversationId is string conversationId)
251+
{
252+
_ = activity.AddTag(OpenTelemetryConsts.GenAI.Conversation.Id, conversationId);
253+
}
254+
250255
if (options.FrequencyPenalty is float frequencyPenalty)
251256
{
252257
_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.FrequencyPenalty, frequencyPenalty);

src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Extensions.AI;
1919

2020
/// <summary>Represents a delegating embedding generator that implements the OpenTelemetry Semantic Conventions for Generative AI systems.</summary>
2121
/// <remarks>
22-
/// This class provides an implementation of the Semantic Conventions for Generative AI systems v1.33, defined at <see href="https://opentelemetry.io/docs/specs/semconv/gen-ai/" />.
22+
/// This class provides an implementation of the Semantic Conventions for Generative AI systems v1.34, defined at <see href="https://opentelemetry.io/docs/specs/semconv/gen-ai/" />.
2323
/// The specification is still experimental and subject to change; as such, the telemetry output by this client is also subject to change.
2424
/// </remarks>
2525
/// <typeparam name="TInput">The type of input used to produce embeddings.</typeparam>

src/Libraries/Microsoft.Extensions.AI/OpenTelemetryConsts.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public static class TokenUsage
5454
}
5555
}
5656

57+
public static class Conversation
58+
{
59+
public const string Id = "gen_ai.conversation.id";
60+
}
61+
5762
public static class Operation
5863
{
5964
public const string Name = "gen_ai.operation.name";

0 commit comments

Comments
 (0)