This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
feat: bf-orchestrator lib integration #4384
Merged
Merged
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
571e4fa
Add bf-orchestrator dependency
taicchoumsft abd474a
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 4c8b17f
Basic API and FT
taicchoumsft d8bcaa9
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft d98e685
Add test to ignore list for now
taicchoumsft 3a1a2c3
Fix linter issues
taicchoumsft ff3bfe7
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 9e53aa8
Update orchestrator-core to pick up Linux fixes
taicchoumsft af001ea
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft d337083
Fixes after latest merge
taicchoumsft 2683207
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 4272952
Attempt to run orchestrator tests on CI
taicchoumsft 1ab34a1
Disable test again local model is available
taicchoumsft 6e21b22
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft ff119aa
Try to bring glic into alpine-linux
boydc2014 0770425
Revert "Try to bring glic into alpine-linux"
boydc2014 6e09c3e
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft f7ad9b3
Try switching to buster for Orchestrator
taicchoumsft 6227bb5
Merge branch 'tachou/orchestratorlib' of https://github.com/microsoft…
taicchoumsft 7e211b6
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft d401109
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 5ccb46c
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft fe3f33a
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 1bc00ba
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 2c372c3
lockdown orchestrator version due to API change
taicchoumsft 37f89b5
Merge branch 'main' into tachou/orchestratorlib
taicchoumsft 4869689
Add libgomp dep for orchestrator
taicchoumsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Composer/packages/server/src/models/bot/__mocks__/mockLUInput.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "name": "emptybot-1.dialog", | ||
| "content": "{\n \"$kind\": \"Microsoft.AdaptiveDialog\",\n \"$designer\": {\n \"name\": \"AddItem\",\n \"id\": \"225905\"\n },\n \"autoEndDialog\": true,\n \"defaultResultProperty\": \"dialog.result\",\n \"triggers\": [\n {\n \"$kind\": \"Microsoft.OnBeginDialog\",\n \"$designer\": {\n \"name\": \"BeginDialog\",\n \"id\": \"479346\"\n },\n \"actions\": [\n {\n \"$kind\": \"Microsoft.SetProperties\",\n \"$designer\": {\n \"id\": \"811190\",\n \"name\": \"Set properties\"\n },\n \"assignments\": [\n {\n \"property\": \"dialog.itemTitle\",\n \"value\": \"=coalesce(@itemTitle, $itemTitle)\"\n },\n {\n \"property\": \"dialog.listType\",\n \"value\": \"=coalesce(@listType, $listType)\"\n }\n ]\n },\n {\n \"$kind\": \"Microsoft.TextInput\",\n \"$designer\": {\n \"id\": \"282825\",\n \"name\": \"AskForTitle\"\n },\n \"prompt\": \"${TextInput_Prompt_282825()}\",\n \"maxTurnCount\": \"3\",\n \"property\": \"dialog.itemTitle\",\n \"value\": \"=coalesce(@itemTitle, $itemTitle)\",\n \"allowInterruptions\": \"!@itemTitle && #_Interruption.Score >= 0.9\"\n },\n {\n \"$kind\": \"Microsoft.ChoiceInput\",\n \"$designer\": {\n \"id\": \"878594\",\n \"name\": \"AskForListType\"\n },\n \"prompt\": \"${TextInput_Prompt_878594()}\",\n \"maxTurnCount\": \"3\",\n \"property\": \"dialog.listType\",\n \"value\": \"=@listType\",\n \"allowInterruptions\": \"!@listType\",\n \"outputFormat\": \"value\",\n \"choices\": [\n {\n \"value\": \"todo\",\n \"synonyms\": [\n \"to do\"\n ]\n },\n {\n \"value\": \"grocery\",\n \"synonyms\": [\n \"groceries\"\n ]\n },\n {\n \"value\": \"shopping\",\n \"synonyms\": [\n \"shoppers\"\n ]\n }\n ],\n \"appendChoices\": \"true\",\n \"defaultLocale\": \"en-us\",\n \"style\": \"Auto\",\n \"choiceOptions\": {\n \"inlineSeparator\": \", \",\n \"inlineOr\": \" or \",\n \"inlineOrMore\": \", or \",\n \"includeNumbers\": true\n },\n \"recognizerOptions\": {\n \"noValue\": false\n }\n },\n {\n \"$kind\": \"Microsoft.EditArray\",\n \"$designer\": {\n \"id\": \"733511\",\n \"name\": \"Edit an Array property\"\n },\n \"changeType\": \"push\",\n \"itemsProperty\": \"user.lists[dialog.listType]\",\n \"value\": \"=$itemTitle\"\n },\n {\n \"$kind\": \"Microsoft.SendActivity\",\n \"$designer\": {\n \"id\": \"139532\",\n \"name\": \"Send a response\"\n },\n \"activity\": \"${SendActivity_139532()}\"\n }\n ]\n }\n ],\n \"generator\": \"additem.lg\",\n \"recognizer\": \"additem.lu\"\n}\n", | ||
| "path": "/Users/tester/Desktop/EmptyBot-1/additem.dialog", | ||
| "relativePath": "", | ||
| "lastModified": "Thu Jul 09 2020 10:19:09 GMT-0700 (Pacific Daylight Time)" | ||
| }, | ||
| { | ||
| "name": "additem.en-us.lu", | ||
| "content": "\n# TextInput_Response_282825\n- Please remind me to {itemTitle=buy milk}\n- Please remember that I need to {itemTitle=buy milk}\n- shoppers", | ||
| "path": "/Users/tester/Desktop/EmptyBot-1/dialogs/additem/language-understanding/en-us/additem.en-us.lu", | ||
| "relativePath": "dialogs/additem/language-understanding/en-us/additem.en-us.lu", | ||
| "lastModified": "Thu Jul 09 2020 10:19:09 GMT-0700 (Pacific Daylight Time)" | ||
| } | ||
| ] |
85 changes: 85 additions & 0 deletions
85
Composer/packages/server/src/models/bot/__tests__/orchestratorBuilder.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import * as path from 'path'; | ||
|
|
||
| import rimraf from 'rimraf'; | ||
| import { FileInfo } from '@bfc/types'; | ||
| import { Utility } from '@microsoft/bf-orchestrator'; | ||
|
|
||
| import { IFileStorage } from '../../storage/interface'; | ||
| import { Builder } from '../builder'; | ||
| import mockLUInput from '../__mocks__/mockLUInput.json'; | ||
|
|
||
| const nlrId = 'pretrained.20200924.microsoft.dte.00.03.en.onnx'; | ||
| const nlrPath: string = path.resolve('./orchestrator_ut_model/'); | ||
| const downloadModelTimeoutMs = 90000; | ||
|
|
||
| describe('Orchestrator Tests', () => { | ||
| beforeAll(async () => { | ||
| // disable Orchestrator Lib console logging across the board - interferes with Jest | ||
| Utility.toPrintDebuggingLogToConsole = false; | ||
|
|
||
| const progressStatusStub = jest.fn(); | ||
| const successStatusStub = jest.fn(); | ||
|
|
||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
|
|
||
| // download the UT NLR model once before all tests are run - build tests don't work without a valid model | ||
| await builder.runOrchestratorNlrGet(nlrPath, nlrId, progressStatusStub, successStatusStub); | ||
taicchoumsft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| expect(progressStatusStub).toBeCalled(); | ||
| expect(successStatusStub).toBeCalledTimes(1); | ||
| }, downloadModelTimeoutMs); | ||
|
|
||
| afterAll(async () => { | ||
| const callbackStub = jest.fn(); | ||
| rimraf(nlrPath, callbackStub); | ||
|
|
||
| expect(callbackStub).toBeCalledWith(); | ||
| }); | ||
|
|
||
| it('always lists DTE 3L model for FTs', async () => { | ||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
|
|
||
| const nlrList = await builder.runOrchestratorNlrList(); | ||
| expect(Object.getOwnPropertyNames(nlrList.models)).toContain(nlrId); | ||
| }); | ||
|
|
||
| it('throws if input empty', () => { | ||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
|
|
||
| expect(builder.runOrchestratorBuild([], nlrPath)).rejects.toThrow(); | ||
| }); | ||
|
|
||
| it('throws if NLR path invalid', () => { | ||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
|
|
||
| const data: FileInfo[] = [{ name: 'hello', content: 'test', lastModified: '', path: '', relativePath: '' }]; | ||
| expect(builder.runOrchestratorBuild(data, 'invalidPath')).rejects.toThrow(); | ||
| }); | ||
|
|
||
| it('produces expected snapshot and recognizer shape', async () => { | ||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
|
|
||
| const buildOutput = await builder.runOrchestratorBuild(mockLUInput, nlrPath); | ||
|
|
||
| expect(buildOutput.outputs.map((o) => o.id)).toContain('additem.en-us.lu'); | ||
|
|
||
| const addItemData = buildOutput.outputs.find((o) => o.id == 'additem.en-us.lu'); | ||
| expect(addItemData?.snapshot).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('produces expected recognizer shape', async () => { | ||
| const builder = new Builder('', {} as IFileStorage, 'en-us'); | ||
| const buildOutput = await builder.runOrchestratorBuild(mockLUInput, nlrPath); | ||
|
|
||
| expect(buildOutput.outputs.map((o) => o.id)).toContain('additem.en-us.lu'); | ||
|
|
||
| const addItemData = buildOutput.outputs.find((o) => o.id == 'additem.en-us.lu'); | ||
| expect(addItemData?.recognizer).toBeTruthy(); | ||
|
|
||
| expect(addItemData?.recognizer.orchestratorRecognizer).toBeTruthy(); | ||
| expect(addItemData?.recognizer.orchestratorRecognizer.$kind).toBe('Microsoft.OrchestratorRecognizer'); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.