Configure AI chat client OpenTelemetry settings
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
Some Azure and Open AI chat client integrations automatically add `OpenTelemetryChatClient`:
* https://github.com/dotnet/aspire/blob/d217f76a9302421d23d82c65085604ba7f16a58a/src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderChatClientExtensions.cs#L76
* https://github.com/dotnet/aspire/blob/d217f76a9302421d23d82c65085604ba7f16a58a/src/Components/Aspire.Azure.AI.Inference/AspireAzureAIInferenceExtensions.cs#L215
However there are settings on `OpenTelemetryChatClient` - notably `EnableSensitiveData` - that can't be configured. `EnableSensitiveData = true` adds important information, such as the prompts sent to the AI system, that is useful during development. There should be some way to configure the OTEL client.
### Describe the solution you'd like
MEAI provides an action to configure the OTEL client:
https://github.com/dotnet/extensions/blob/9e041fff9a8c06efce8dd335de03868ff9ee8556/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClientBuilderExtensions.cs#L26-L30
An optional argument like this could be added to the helper extension methods that register the client.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.