60 references to GenAI
Microsoft.Extensions.AI (60)
ChatCompletion\OpenTelemetryChatClient.cs (39)
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 }); 219string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Chat : $"{OpenTelemetryConsts.GenAI.Chat} {modelId}", 225.AddTag(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat) 226.AddTag(OpenTelemetryConsts.GenAI.Request.Model, modelId) 227.AddTag(OpenTelemetryConsts.GenAI.SystemName, _system); 240_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.FrequencyPenalty, frequencyPenalty); 245_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.MaxTokens, maxTokens); 250_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PresencePenalty, presencePenalty); 255_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.StopSequences, $"[{string.Join(", ", stopSequences.Select(s => $"\"{s}\""))}]"); 260_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.Temperature, temperature); 265_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopK, topK); 270_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopP, top_p); 284_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "response_format"), responseFormat); 289_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "seed"), seed); 325tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 333tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "output"); 355_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.FinishReasons, $"[\"{finishReason.Value.ToLowerInvariant()}\"]"); 361_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Id, completion.CompletionId); 366_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, completion.ModelId); 371_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 376_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.OutputTokens, outputTokens); 383tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat); 387tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 390tags.Add(OpenTelemetryConsts.GenAI.SystemName, _system); 400tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModel); 416Log(new(1, OpenTelemetryConsts.GenAI.Assistant.Message), 423Log(new(1, OpenTelemetryConsts.GenAI.Tool.Message), 435Log(new(1, message.Role == ChatRole.System ? OpenTelemetryConsts.GenAI.System.Message : OpenTelemetryConsts.GenAI.User.Message), 452EventId id = new(1, OpenTelemetryConsts.GenAI.Choice); 474new(OpenTelemetryConsts.GenAI.SystemName, _system),
Embeddings\OpenTelemetryEmbeddingGenerator.cs (21)
63OpenTelemetryConsts.GenAI.Client.TokenUsage.Name, 65OpenTelemetryConsts.GenAI.Client.TokenUsage.Description, 66advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }); 69OpenTelemetryConsts.GenAI.Client.OperationDuration.Name, 71OpenTelemetryConsts.GenAI.Client.OperationDuration.Description, 72advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }); 129string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Embed : $"{OpenTelemetryConsts.GenAI.Embed} {modelId}", 133new(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embed), 134new(OpenTelemetryConsts.GenAI.Request.Model, modelId), 135new(OpenTelemetryConsts.GenAI.SystemName, _modelProvider), 149_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.EmbeddingDimensions, dimensions); 191tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 208_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 213_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, responseModelId); 220tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embed); 224tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 227tags.Add(OpenTelemetryConsts.GenAI.SystemName, _modelProvider); 238tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModelId);