-
Notifications
You must be signed in to change notification settings - Fork 115
[SDK] Add bot-ai-qna library #907
[SDK] Add bot-ai-qna library #907
Conversation
Parts of the QnAMakerDialog have been updated to be Adaptive friendly. This won't apply for this version on the Java SDK since Adaptive won't be part of the GA release. For example, in QnAMakerDialog: StringExpression, IntegerExpression, etc... Other:
|
Thanks @tracyboehrer for the feedback! We will be applying the changes as soon as we can 😊. |
* Delete QnAMakerComponentRegistration class * Delete schema folder * Fix ref to AdaptiveExpressions in QnAMakerDialog * Fix ref adaptiveExpressions in QnAMakerRecognizer * Apply internal feedback * Add dialogs library, fix references * Fix PMD and checkstyles errors * Add description in javadocs for IOException * Apply internal feedback
* Add files into the TestData folder * Add QnAMakerTraceInfoTests * Add MyTurnContext class * Change tests location * Add MyTurnContext class * Add returns in set and get Locale methods * Fix consistency multi-line methods * Add default inputHint Co-authored-by: Martin Battaglino <[email protected]> * Add QnAMakerCardEqualityComparer * Change tests location * Add QnAMakerCardEqualityComparer class Co-authored-by: Martin Battaglino <[email protected]> * Move location of QnAMakerTraceInfoTests * Remove TestData * Add testData * Add QnAMakerTest class * Add files into the TestData folder * Change location of tests * Add Mockito dependency * Add more test to QnAMakerTests class * Migrate more tests * Remove TestData * Add testData * Add QnAMakerTraceInfoTests * Add MyTurnContext class * Change tests location * Add MyTurnContext class * Add returns in set and get Locale methods * Fix consistency multi-line methods * Add default inputHint Co-authored-by: Martin Battaglino <[email protected]> * Add QnAMakerCardEqualityComparer * Change tests location * Add QnAMakerCardEqualityComparer class Co-authored-by: Martin Battaglino <[email protected]> * Add private methods in QnAMakerTests * Fix issues * Add MockWebServer to tests * replace ref to interceptHttp * Add try/catch/finally * Replace thenApply with thenAccept * Add mocked OkHttpClient * Fix errors * Fix delta * Remove merge files * Fix QnAMakerTest * Clean-up pom, remove QnAMakerDialogTest, update QnAMakerTests Co-authored-by: Martin Battaglino <[email protected]> Co-authored-by: Franco Alvarez <[email protected]>
* Add QnAMakerRecognizer, tests and fix some issues * Apply internal feedback
* Fix QnAMakerRecognizerTests unit tests * Fix mock issues and internal issues * Fix QnAMakerRecognizerTests unit tests * Rollback unused changes * Add body in http execution * Fix tests execution adding the correct Test import * Apply internal feedback * Fix QnA unit tests * Fix generate answer utils * Fix errors * Fix mock issues and internal issues * Fix issues with the url * Add remaining join * Fix qnaMakerTestUnsuccessfulResponse test * Refactor of QnAMakerTests * Import correct json and fix string format * Fix qnaMakerTraceActivity test * Fix tests with request object * Fix qnaMakerLowScoreVariation * Fix qnaMakerTestThresholdInQueryOption test * Fix telemetryOverride test * Enable qnaMakerTestOptionsHydration failing test * Fix qnaMakerTestOptionsHydration test * Fix telemetry tests * Fix disparity in GenerateAnswerUtils * Fix remaining unit tests * Change jupiter to junit * Remove mockito-junit-jupiter dependency * Fix checkstyle errors * Apply internal feedback Co-authored-by: Franco Alvarez <[email protected]> Co-authored-by: Federico Bernal <[email protected]> * Rollback id to Id * Improve readFileContent method and remove comments Co-authored-by: Franco Alvarez <[email protected]> Co-authored-by: Federico Bernal <[email protected]>
Hi @tracyboehrer , we finished with the migration of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Drop "I" for IQnAMakerClient and ITelemetryQnAMaker to be consistent with other Java SDK interfaces
- Drop QnAMaker.kind and associated getter. This is an Adaptive thing that isn't used yet.
- I believe we can drop QnAMaker constructor "sourceFilePath" and "sourceLineNumber". This is part of DotNets debugging that we don't currently have in Java.
- I believe we can delete resources/icon.png. I think this is just for NuGet packaging in DotNet.
- Is QnAMaker.httpClient (and accessors) used? DotNet support passing in a custom client that we haven't supported anywhere else.
Bug
QnAMaker.getAnswerRaw
if (messageActivity == null || messageActivity.getType() != ActivityTypes.MESSAGE) {
Activity.getType is a string so that comparison won't work. Use:
Activity.isType(ActivityTypes.MESSAGE)
Recommend searching for "getType()" and see if that happens elsewhere.
Bug
QnAMakerDialog.callTrain, line 934
QueryResult qnaResult = trainResponses
.stream().filter(kvp -> kvp.getQuestions()[0] == reply).findFirst().orElse(null);
Performing string comparison with ==. We typically use StringUtils.equals.
Recommend maybe searching for "==", "!=", etc... and checking for other string comparisons. This would also help you find the previous bug.
Minor:
QnAMaker.fillQnAEvent:
return CompletableFuture.completedFuture(new Pair(telemetryPropertiesResult, telemetryMetricsResult));
Produces an unchecked assignment warning. Should be:
return CompletableFuture.completedFuture(new Pair<>(telemetryPropertiesResult, telemetryMetricsResult));
@Batta32 Lee said there is a CheckStyle rule you can add that will flag string comparisons. That might be the quickest way to find those. Check with him on that. We were going to add it as part of the work Lee is doing, but its just as well if you do. |
This is what you can add as a child to the section:
|
Thanks @tracyboehrer and @LeeParrishMSFT for your feedback! We will be implementing the requested changes in order to update the PR.
|
* Remove I from ITelemetryQnAMaker IQnAMakerClient * Remove kind property * Drop unused constructor in QnAMakerDialog * Remove resources/icon.png * Replace getType with isType * Replace == comparison * Fix unchecked assignment warning in fillQnAEvent * Add StringLiteralEquality * Remove sourceFilePath and sourceLineNumber * Use activity.getType in tests * Remove unnecesary whitespace Co-authored-by: Martin Battaglino <[email protected]>
Hi @tracyboehrer & @LeeParrishMSFT, we already applied the requested changes 😊. |
@Batta32 Awesome! Can you merge the latest from main? |
Done! |
Fixes #740
Description
We are adding the SDK bot-ai-qna library in Java having into account the C# Microsoft.Bot.Builder.AI.QnA present in botbuilder-dotnet repository.
Specific Changes
dialogs
foldermodels
foldericon.png
in resources folderutils
foldertestData
folderQnAMakerRecognizerTests
unit testsQnAMakerTests
unit testsQnAMakerTraceInfoTests
unit testsMigrated structure
Migrated test structure
Testing
QnA tests passing correctly 48/48
mvn clean install passing correctly
Feature Plan
-