64 references to GenAI
Microsoft.Extensions.AI (64)
ChatCompletion\OpenTelemetryChatClient.cs (41)
69OpenTelemetryConsts.GenAI.Client.TokenUsage.Name, 71OpenTelemetryConsts.GenAI.Client.TokenUsage.Description, 72advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }); 75OpenTelemetryConsts.GenAI.Client.OperationDuration.Name, 77OpenTelemetryConsts.GenAI.Client.OperationDuration.Description, 78advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }); 220string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Chat : $"{OpenTelemetryConsts.GenAI.Chat} {modelId}", 226.AddTag(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat) 227.AddTag(OpenTelemetryConsts.GenAI.Request.Model, modelId) 228.AddTag(OpenTelemetryConsts.GenAI.SystemName, _system); 241_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.FrequencyPenalty, frequencyPenalty); 246_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.MaxTokens, maxTokens); 251_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PresencePenalty, presencePenalty); 256_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.StopSequences, $"[{string.Join(", ", stopSequences.Select(s => $"\"{s}\""))}]"); 261_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.Temperature, temperature); 266_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopK, topK); 271_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopP, top_p); 285_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "response_format"), responseFormat); 290_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "seed"), seed); 301OpenTelemetryConsts.GenAI.Request.PerProvider(_system, JsonNamingPolicy.SnakeCaseLower.ConvertName(prop.Key)), 339tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 347tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "output"); 369_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.FinishReasons, $"[\"{finishReason.Value.ToLowerInvariant()}\"]"); 375_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Id, completion.CompletionId); 380_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, completion.ModelId); 385_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 390_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.OutputTokens, outputTokens); 403OpenTelemetryConsts.GenAI.Response.PerProvider(_system, JsonNamingPolicy.SnakeCaseLower.ConvertName(prop.Key)), 413tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat); 417tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 420tags.Add(OpenTelemetryConsts.GenAI.SystemName, _system); 430tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModel); 446Log(new(1, OpenTelemetryConsts.GenAI.Assistant.Message), 453Log(new(1, OpenTelemetryConsts.GenAI.Tool.Message), 465Log(new(1, message.Role == ChatRole.System ? OpenTelemetryConsts.GenAI.System.Message : OpenTelemetryConsts.GenAI.User.Message), 482EventId id = new(1, OpenTelemetryConsts.GenAI.Choice); 504new(OpenTelemetryConsts.GenAI.SystemName, _system),
Embeddings\OpenTelemetryEmbeddingGenerator.cs (23)
66OpenTelemetryConsts.GenAI.Client.TokenUsage.Name, 68OpenTelemetryConsts.GenAI.Client.TokenUsage.Description, 69advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }); 72OpenTelemetryConsts.GenAI.Client.OperationDuration.Name, 74OpenTelemetryConsts.GenAI.Client.OperationDuration.Description, 75advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }); 132string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Embeddings : $"{OpenTelemetryConsts.GenAI.Embeddings} {modelId}", 136new(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embeddings), 137new(OpenTelemetryConsts.GenAI.Request.Model, modelId), 138new(OpenTelemetryConsts.GenAI.SystemName, _modelProvider), 152_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.EmbeddingDimensions, dimensions); 166OpenTelemetryConsts.GenAI.Request.PerProvider(_system, JsonNamingPolicy.SnakeCaseLower.ConvertName(prop.Key)), 211tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 228_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 233_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, responseModelId); 245OpenTelemetryConsts.GenAI.Response.PerProvider(_system, JsonNamingPolicy.SnakeCaseLower.ConvertName(prop.Key)), 254tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embeddings); 258tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 261tags.Add(OpenTelemetryConsts.GenAI.SystemName, _modelProvider); 272tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModelId);