Skip to content

[#6889] CQA to support TokenCredential instead of key #6890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

sw-joelmut
Copy link
Collaborator

Fixes #6889

Description

This PR adds the ability to use a Managed Identity ClientId to authenticate to the Language service.

Specific Changes

  • Added QuestionAnswering and Azure.Identity packages
  • Updated/Added constructors to receive the Managed Identity ClientId.
  • Updated GetAnswers and AddFeedback methods to match the new QuestionAnswering package.

Testing

The following images show the GetAnswers and AddFeedback functionalities working with the existing EndpointKey and the new MSI ClientId.
imagen
imagen

@sw-joelmut sw-joelmut added the Automation: Parity with js The PR needs to be ported to JS label Apr 11, 2025
@sw-joelmut sw-joelmut requested a review from tracyboehrer April 11, 2025 16:21
@tracyboehrer
Copy link
Member

Getting this on build:

tests\Microsoft.Bot.Builder.AI.QnA.Tests\LanguageServiceTests.cs(1103,21): Error CS0121: The call is ambiguous between the following methods or properties: 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, HttpClient)' and 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, IBotTelemetryClient, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln |   |   -- | -- | --   | tests\Microsoft.Bot.Builder.AI.QnA.Tests\LanguageServiceTests.cs(1153,56): Error CS0121: The call is ambiguous between the following methods or properties: 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, HttpClient)' and 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, IBotTelemetryClient, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln |   |     | tests\Microsoft.Bot.Builder.AI.QnA.Tests\LanguageServiceTests.cs(1171,56): Error CS0121: The call is ambiguous between the following methods or properties: 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, HttpClient)' and 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, IBotTelemetryClient, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln |   |     | tests\Microsoft.Bot.Builder.AI.QnA.Tests\LanguageServiceTests.cs(1291,27): Error CS0121: The call is ambiguous between the following methods or properties: 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, HttpClient)' and 'CustomQuestionAnswering.CustomQuestionAnswering(QnAMakerEndpoint, IBotTelemetryClient, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln |   |     | tests\Microsoft.Bot.Builder.AI.QnA.Tests\QnAMakerTests.cs(1989,31): Error CS0121: The call is ambiguous between the following methods or properties: 'QnAMakerDialog.QnAMakerDialog(string, string, string, Activity, float, string, string, int, Activity, Metadata[], Filters, ServiceType, HttpClient, string, int, bool)' and 'QnAMakerDialog.QnAMakerDialog(string, string, string, Activity, float, string, string, int, Activity, Metadata[], Filters, ServiceType, string, int, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln |   |     | tests\Microsoft.Bot.Builder.AI.QnA.Tests\LanguageServiceTests.cs(2223,31): Error CS0121: The call is ambiguous between the following methods or properties: 'QnAMakerDialog.QnAMakerDialog(string, string, string, Activity, float, string, string, int, Activity, Metadata[], Filters, ServiceType, HttpClient, string, int, bool)' and 'QnAMakerDialog.QnAMakerDialog(string, string, string, Activity, float, string, string, int, Activity, Metadata[], Filters, ServiceType, string, int, bool, HttpClient)'Build • Debug_Windows_Configuration_8 • Build solution Microsoft.Bot.Builder.sln

@sw-joelmut sw-joelmut requested a review from tracyboehrer April 21, 2025 16:03
@sw-joelmut
Copy link
Collaborator Author

Hi @tracyboehrer, while looking how this will be implemented in JS, we discovered an easier way (using an Authorization header) that involves fewer changes in the code and doesn't require a dependency, that also might work for DotNet.

To maintain parity between the two languages and to avoid introducing the QuestionAnswering package (that has some limitations), we consider that this new way could be implemented instead.

Let us know if you would like us to implement this approach, or if we should keep the QuestionAnswering package with the 'mapping' logic' for DotNet.

@tracyboehrer
Copy link
Member

tracyboehrer commented Apr 29, 2025 via email

@ceciliaavila
Copy link
Collaborator

We're closing this as a more effective solution has been identified using the Authorization header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation: Parity with js The PR needs to be ported to JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CQA to support TokenCredential instead of key
3 participants