Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into BUILD/aoai
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyydu committed May 16, 2024
2 parents bf711c5 + 7465682 commit f8c156b
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion js/packages/teams-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@microsoft/teams-ai",
"author": "Microsoft Corp.",
"description": "SDK focused on building AI based applications for Microsoft Teams.",
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",
"keywords": [
"botbuilder",
Expand Down
16 changes: 8 additions & 8 deletions js/packages/teams-ai/src/planners/AssistantsPlanner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('AssistantsPlanner', () => {
assert(plan.commands);
assert.equal(plan.commands.length, 1);
assert.equal(plan.commands[0].type, 'SAY');
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response);
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response.content);
});

it('waits for current run', async () => {
Expand All @@ -113,7 +113,7 @@ describe('AssistantsPlanner', () => {
assert(plan.commands);
assert.equal(plan.commands.length, 1);
assert.equal(plan.commands[0].type, 'SAY');
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response);
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response.content);
});

it('waits for previous run', async () => {
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('AssistantsPlanner', () => {
assert(plan.commands);
assert.equal(plan.commands.length, 1);
assert.equal(plan.commands[0].type, 'SAY');
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response);
assert.equal('welcome', (plan.commands[0] as PredictedSayCommand).response.content);
});

it('run cancelled', async () => {
Expand Down Expand Up @@ -274,7 +274,7 @@ describe('AssistantsPlanner', () => {
assert(plan2);
assert(plan2.commands);
assert.equal(plan2.commands[0].type, 'SAY');
assert.equal((plan2.commands[0] as PredictedSayCommand).response, 'welcome');
assert.equal((plan2.commands[0] as PredictedSayCommand).response.content, 'welcome');

const toolMap: { [key: string]: string } = state.getValue('temp.submit_tool_map');
assert(toolMap);
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('AssistantsPlanner', () => {
assert(plan2);
assert(plan2.commands);
assert.equal(plan2.commands[0].type, 'SAY');
assert.equal((plan2.commands[0] as PredictedSayCommand).response, 'welcome');
assert.equal((plan2.commands[0] as PredictedSayCommand).response.content, 'welcome');

const toolMap: { [key: string]: string } = state.getValue('temp.submit_tool_map');
assert(toolMap);
Expand Down Expand Up @@ -367,9 +367,9 @@ describe('AssistantsPlanner', () => {
assert(plan.commands);
assert.equal(plan.commands.length, 3);
assert.equal(plan.commands[0].type, 'SAY');
assert.equal((plan.commands[0] as PredictedSayCommand).response, 'message 2');
assert.equal((plan.commands[1] as PredictedSayCommand).response, 'message 1');
assert.equal((plan.commands[2] as PredictedSayCommand).response, 'welcome');
assert.equal((plan.commands[0] as PredictedSayCommand).response.content, 'message 2');
assert.equal((plan.commands[1] as PredictedSayCommand).response.content, 'message 1');
assert.equal((plan.commands[2] as PredictedSayCommand).response.content, 'welcome');
});
});
});
Expand Down
14 changes: 13 additions & 1 deletion js/packages/teams-ai/src/planners/AssistantsPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,19 @@ export class AssistantsPlanner<TState extends TurnState = TurnState> implements
if (content.type == 'text') {
plan.commands.push({
type: 'SAY',
response: (content as any).text.value
response: {
role: 'assistant',
content: content.text.value,
context: {
intent: '',
citations: content.text.annotations.map(annotation => ({
title: '',
url: '',
filepath: '',
content: annotation.text
}))
}
}
} as PredictedSayCommand);
}
});
Expand Down
2 changes: 1 addition & 1 deletion js/samples/01.getting-started/a.echoBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai/"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
"openai": "4.28.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"axios": "^1.6.8",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"axios": "^1.6.8",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/a.twentyQuestions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"botbuilder": "^4.22.2",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"dotenv": "^16.4.5",
"openai": "4.28.4",
"replace": "~1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"botbuilder": "^4.22.2",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"dotenv": "^16.4.5",
"openai": "4.28.4",
"replace": "~1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"botbuilder": "^4.22.2",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"dotenv": "^16.4.5",
"openai": "4.28.4",
"replace": "~1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
"openai": "4.28.4",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/e.customModel-LLAMA/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"botbuilder": "^4.22.2",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"openai": "4.28.4",
"dotenv": "^16.4.1",
"replace": "~1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/f.chatModeration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"axios": "^1.6.8",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/a.teamsChefBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"@microsoft/teamsfx": "^2.3.1",
"@microsoft/teams-js": "^2.23.0",
"botbuilder": "^4.22.2",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/b.devOpsBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"botbuilder": "^4.22.2",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"dotenv": "^16.4.5",
"replace": "~1.2.0",
"restify": "~11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/c.vision-cardGazer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"@microsoft/teamsfx": "^2.3.1",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/d.assistants-mathBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"axios": "^1.6.8",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/e.assistants-orderBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"axios": "^1.6.8",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/f.whoBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"botbuilder-dialogs": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@azure/search-documents": "12.0.0",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"@microsoft/teamsfx": "^2.3.1",
"botbuilder": "^4.22.2",
"debug": "^4.3.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@azure/search-documents": "12.0.0",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"@microsoft/teamsfx": "^2.3.0",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.1",
Expand Down
9 changes: 2 additions & 7 deletions js/samples/04.ai-apps/h.datasource-azureOpenAI/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ error.log = console.log.bind(console);
interface ConversationState {}
type ApplicationTurnState = TurnState<ConversationState>;

if (
!process.env.AZURE_OPENAI_KEY ||
!process.env.AZURE_OPENAI_ENDPOINT
) {
throw new Error(
'Missing environment variables - please check that AZURE_OPENAI_KEY, AZURE_OPENAI_ENDPOINT, AZURE_SEARCH_KEY, AZURE_SEARCH_ENDPOINT are all set.'
);
if (!process.env.AZURE_OPENAI_KEY || !process.env.AZURE_OPENAI_ENDPOINT) {
throw new Error('Missing environment variables - please check that AZURE_OPENAI_KEY and AZURE_OPENAI_ENDPOINT');
}

// Create AI components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
"openai": "4.28.4",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/05.authentication/b.oauth-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"botbuilder-dialogs": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"dotenv": "^16.4.5",
"isomorphic-fetch": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/05.authentication/d.teamsSSO-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/microsoft/teams-ai"
},
"dependencies": {
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"botbuilder-dialogs": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/teams-ai": "~1.2.0",
"@microsoft/teams-ai": "~1.2.1",
"botbuilder": "^4.22.2",
"botbuilder-azure-blobs": "^4.22.2",
"dotenv": "^16.4.5",
Expand Down

0 comments on commit f8c156b

Please sign in to comment.