From fc48bff34fd7467454692aa13980c8e5796dd04a Mon Sep 17 00:00:00 2001 From: Corina <14900841+corinagum@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:37:01 -0700 Subject: [PATCH] [JS] fix: Citations where context was being dropped in OpenAIModel.ts (#2136) ## Linked issues closes: #2131 closes: #2080 ## Details - Change the abstract length to 477, in the rare case where the word clips at >477 but <480, then adds ellipses - `OpenAIModel`: re-add message context so it is not being dropped from `ToolsAugmentation` changes. This now means citations are being rendered as expected. image ## Attestation Checklist - [x] My code follows the style guidelines of this project - I have checked for/fixed spelling, linting, and other errors - I have commented my code for clarity - I have made corresponding changes to the documentation (updating the doc strings in the code is sufficient) - My changes generate no new warnings - I have added tests that validates my changes, and provides sufficient test coverage. I have tested with: - Local testing - E2E testing in Teams - New and existing unit tests pass locally with my changes ### Additional information > Feel free to add other relevant information below --------- Co-authored-by: Corina Gum <> --- .../AI/Action/DefaultActions.cs | 2 +- js/packages/teams-ai/package.json | 10 ++-- .../teams-ai/src/actions/SayCommand.ts | 2 +- .../teams-ai/src/models/OpenAIModel.spec.ts | 54 +++++++++++++++++++ .../teams-ai/src/models/OpenAIModel.ts | 42 +++++++++------ .../01.getting-started/a.echoBot/package.json | 2 +- .../package.json | 2 +- .../b.adaptiveCards.typeAheadBot/package.json | 2 +- .../a.twentyQuestions/package.json | 2 +- .../b.AI-messageExtensions/package.json | 2 +- .../c.actionMapping-lightBot/package.json | 2 +- .../d.chainedActions-listBot/package.json | 2 +- .../e.customModel-LLAMA/package.json | 2 +- .../f.chatModeration/package.json | 2 +- .../04.ai-apps/a.teamsChefBot/package.json | 2 +- .../c.vision-cardGazer/package.json | 2 +- .../d.assistants-mathBot/package.json | 2 +- .../e.assistants-orderBot/package.json | 2 +- js/samples/04.ai-apps/f.whoBot/package.json | 2 +- .../g.datasource-azureAISearch/package.json | 2 +- .../h.datasource-azureOpenAI/package.json | 2 +- .../a.oauth-adaptiveCard/package.json | 2 +- .../b.oauth-bot/package.json | 2 +- .../c.oauth-messageExtension/package.json | 2 +- .../d.teamsSSO-bot/package.json | 2 +- .../e.teamsSSO-messageExtension/package.json | 2 +- js/yarn.lock | 6 +-- python/packages/ai/teams/ai/ai.py | 2 +- 28 files changed, 111 insertions(+), 49 deletions(-) diff --git a/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/Action/DefaultActions.cs b/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/Action/DefaultActions.cs index ae3e243e6..76a878aca 100644 --- a/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/Action/DefaultActions.cs +++ b/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/Action/DefaultActions.cs @@ -105,7 +105,7 @@ public async Task SayCommandAsync([ActionTurnContext] ITurnContext turnC int i = 0; foreach (Citation citation in command.Response.Context.Citations) { - string abs = CitationUtils.Snippet(citation.Content, 480); + string abs = CitationUtils.Snippet(citation.Content, 477); if (isTeamsChannel) { content.Replace("\n", "
"); diff --git a/js/packages/teams-ai/package.json b/js/packages/teams-ai/package.json index c6d77f14a..f6c065d47 100644 --- a/js/packages/teams-ai/package.json +++ b/js/packages/teams-ai/package.json @@ -25,17 +25,17 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "peerDependencies": { - "botbuilder": "^4.23.0", - "openai": "^4.61.0" + "botbuilder": "^4.23.1", + "openai": "^4.68.2" }, "dependencies": { "@azure/openai-assistants": "1.0.0-beta.6", "@azure/msal-node": "^2.15.0", "axios": "^1.7.5", "botbuilder-dialogs": "^4.23.1", - "botframework-connector": "^4.23.0", - "botframework-schema": "^4.23.0", - "botframework-streaming": "^4.23.0", + "botframework-connector": "^4.23.1", + "botframework-schema": "^4.23.1", + "botframework-streaming": "^4.23.1", "gpt-tokenizer": "^2.5.1", "json-colorizer": "^2.2.2", "jsonschema": "1.4.1", diff --git a/js/packages/teams-ai/src/actions/SayCommand.ts b/js/packages/teams-ai/src/actions/SayCommand.ts index 1e0364159..d16e232e7 100644 --- a/js/packages/teams-ai/src/actions/SayCommand.ts +++ b/js/packages/teams-ai/src/actions/SayCommand.ts @@ -41,7 +41,7 @@ export function sayCommand(feedbackLoopEna appearance: { '@type': 'DigitalDocument', name: citation.title || `Document #${i + 1}`, - abstract: Utilities.snippet(citation.content, 480) + abstract: Utilities.snippet(citation.content, 477) } }; diff --git a/js/packages/teams-ai/src/models/OpenAIModel.spec.ts b/js/packages/teams-ai/src/models/OpenAIModel.spec.ts index 3ea2a12d1..390e2d9a0 100644 --- a/js/packages/teams-ai/src/models/OpenAIModel.spec.ts +++ b/js/packages/teams-ai/src/models/OpenAIModel.spec.ts @@ -1,3 +1,5 @@ +/// + import { strict as assert } from 'assert'; import sinon from 'sinon'; import { OpenAIModel } from './OpenAIModel'; @@ -87,4 +89,56 @@ describe('OpenAIModel', () => { ) ); }); + + it('should handle citations in the context', async () => { + const model = new OpenAIModel({ + apiKey: 'test-api-key', + endpoint: 'https://test-endpoint.com', + defaultModel: 'gpt-3.5-turbo' + }); + + const mockResponse = { + choices: [{ + message: { + role: 'assistant', + content: 'Test response', + context: { + citations: [ + { + content: 'Citation content', + title: 'Citation title', + url: 'https://citation.url' + } + ] + } + } + }] + }; + + // Mock the API call + sinon.stub(model['_client'].chat.completions, 'create').resolves(mockResponse as any); + + // Mock necessary parameters for completePrompt method + const context: any = {}; + const memory: any = { getValue: () => ({}) }; + const functions: any = {}; + const tokenizer: any = {}; + const template: any = { + config: { completion: {} }, + prompt: { renderAsMessages: async () => ({ output: [] }) } + }; + + const result = await model.completePrompt(context, memory, functions, tokenizer, template); + + assert.equal(result.status, 'success'); + assert.equal(result.message?.role, 'assistant'); + assert.equal(result.message?.content, 'Test response'); + assert.deepEqual(result.message?.context?.citations, [ + { + content: 'Citation content', + title: 'Citation title', + url: 'https://citation.url' + } + ]); + }); }); diff --git a/js/packages/teams-ai/src/models/OpenAIModel.ts b/js/packages/teams-ai/src/models/OpenAIModel.ts index 0b493a447..11734fe5f 100644 --- a/js/packages/teams-ai/src/models/OpenAIModel.ts +++ b/js/packages/teams-ai/src/models/OpenAIModel.ts @@ -375,16 +375,18 @@ export class OpenAIModel implements PromptCompletionModel { } // Handle tool calls if (delta.tool_calls) { - message.action_calls = delta.tool_calls.map((toolCall) => { - return { - id: toolCall.id, - function: { - name: toolCall.function!.name, - arguments: toolCall.function!.arguments - }, - type: toolCall.type - } as ActionCall; - }); + message.action_calls = delta.tool_calls.map( + (toolCall: OpenAI.Chat.Completions.ChatCompletionChunk.Choice.Delta.ToolCall) => { + return { + id: toolCall.id, + function: { + name: toolCall.function!.name, + arguments: toolCall.function!.arguments + }, + type: toolCall.type + } as ActionCall; + } + ); } // Signal chunk received @@ -400,8 +402,19 @@ export class OpenAIModel implements PromptCompletionModel { console.log(Colorize.value('duration', Date.now() - startTime, 'ms')); } } else { - const actionCalls: ActionCall[] = []; const responseMessage = (completion as ChatCompletion).choices![0].message; + message = { + role: responseMessage.role, + content: responseMessage.content ?? '' + }; + + // Preserve message context if there is any + const messageWithContext = responseMessage as Message; + + if (messageWithContext.context) { + message.context = messageWithContext.context; + } + const actionCalls: ActionCall[] = []; const isToolsAugmentation = template.config.augmentation && template.config.augmentation?.augmentation_type == 'tools'; @@ -418,16 +431,11 @@ export class OpenAIModel implements PromptCompletionModel { }); } } - // Log the generated response - message = { - role: responseMessage.role, - content: responseMessage.content ?? '' - }; - if (actionCalls.length > 0) { message.action_calls = actionCalls; } + // Log the generated response if (this.options.logRequests) { console.log(Colorize.title('CHAT RESPONSE:')); console.log(Colorize.value('duration', Date.now() - startTime, 'ms')); diff --git a/js/samples/01.getting-started/a.echoBot/package.json b/js/samples/01.getting-started/a.echoBot/package.json index 1e2f4a674..43e1c2c6b 100644 --- a/js/samples/01.getting-started/a.echoBot/package.json +++ b/js/samples/01.getting-started/a.echoBot/package.json @@ -25,7 +25,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/02.teams-features/a.messageExtensions.searchCommand/package.json b/js/samples/02.teams-features/a.messageExtensions.searchCommand/package.json index ae9b1f296..c028dea82 100644 --- a/js/samples/02.teams-features/a.messageExtensions.searchCommand/package.json +++ b/js/samples/02.teams-features/a.messageExtensions.searchCommand/package.json @@ -23,7 +23,7 @@ "axios": "^1.7.5", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/02.teams-features/b.adaptiveCards.typeAheadBot/package.json b/js/samples/02.teams-features/b.adaptiveCards.typeAheadBot/package.json index 26077b48d..d629985db 100644 --- a/js/samples/02.teams-features/b.adaptiveCards.typeAheadBot/package.json +++ b/js/samples/02.teams-features/b.adaptiveCards.typeAheadBot/package.json @@ -26,7 +26,7 @@ "axios": "^1.7.5", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/03.ai-concepts/a.twentyQuestions/package.json b/js/samples/03.ai-concepts/a.twentyQuestions/package.json index 34ff44d9f..44fe32d69 100644 --- a/js/samples/03.ai-concepts/a.twentyQuestions/package.json +++ b/js/samples/03.ai-concepts/a.twentyQuestions/package.json @@ -24,7 +24,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/03.ai-concepts/b.AI-messageExtensions/package.json b/js/samples/03.ai-concepts/b.AI-messageExtensions/package.json index 7c5ede910..97af16455 100644 --- a/js/samples/03.ai-concepts/b.AI-messageExtensions/package.json +++ b/js/samples/03.ai-concepts/b.AI-messageExtensions/package.json @@ -22,7 +22,7 @@ "botbuilder": "^4.23.1", "@microsoft/teams-ai": "~1.5.2", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/03.ai-concepts/c.actionMapping-lightBot/package.json b/js/samples/03.ai-concepts/c.actionMapping-lightBot/package.json index ce3610109..8b9798304 100644 --- a/js/samples/03.ai-concepts/c.actionMapping-lightBot/package.json +++ b/js/samples/03.ai-concepts/c.actionMapping-lightBot/package.json @@ -24,7 +24,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/03.ai-concepts/d.chainedActions-listBot/package.json b/js/samples/03.ai-concepts/d.chainedActions-listBot/package.json index ee06e3ac9..706e560e9 100644 --- a/js/samples/03.ai-concepts/d.chainedActions-listBot/package.json +++ b/js/samples/03.ai-concepts/d.chainedActions-listBot/package.json @@ -24,7 +24,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/03.ai-concepts/e.customModel-LLAMA/package.json b/js/samples/03.ai-concepts/e.customModel-LLAMA/package.json index 7c4aaf1cb..23e744b2f 100644 --- a/js/samples/03.ai-concepts/e.customModel-LLAMA/package.json +++ b/js/samples/03.ai-concepts/e.customModel-LLAMA/package.json @@ -24,7 +24,7 @@ "dependencies": { "botbuilder": "^4.23.1", "@microsoft/teams-ai": "~1.5.2", - "openai": "4.61.0", + "openai": "4.68.2", "dotenv": "^16.4.1", "replace": "~1.2.0", "restify": "~11.1.0" diff --git a/js/samples/03.ai-concepts/f.chatModeration/package.json b/js/samples/03.ai-concepts/f.chatModeration/package.json index 5cf1d9160..3cffadc00 100644 --- a/js/samples/03.ai-concepts/f.chatModeration/package.json +++ b/js/samples/03.ai-concepts/f.chatModeration/package.json @@ -24,7 +24,7 @@ "botbuilder": "^4.23.1", "dotenv": "^16.4.5", "jsonwebtoken": "^9.0.2", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/04.ai-apps/a.teamsChefBot/package.json b/js/samples/04.ai-apps/a.teamsChefBot/package.json index 20ac5f909..21c58b109 100644 --- a/js/samples/04.ai-apps/a.teamsChefBot/package.json +++ b/js/samples/04.ai-apps/a.teamsChefBot/package.json @@ -26,7 +26,7 @@ "@microsoft/teams-js": "^2.29.0", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0", "vectra": "^0.9.0" diff --git a/js/samples/04.ai-apps/c.vision-cardGazer/package.json b/js/samples/04.ai-apps/c.vision-cardGazer/package.json index 56cfaa744..c0e44337a 100644 --- a/js/samples/04.ai-apps/c.vision-cardGazer/package.json +++ b/js/samples/04.ai-apps/c.vision-cardGazer/package.json @@ -23,7 +23,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/04.ai-apps/d.assistants-mathBot/package.json b/js/samples/04.ai-apps/d.assistants-mathBot/package.json index a8825ed0f..f847c118f 100644 --- a/js/samples/04.ai-apps/d.assistants-mathBot/package.json +++ b/js/samples/04.ai-apps/d.assistants-mathBot/package.json @@ -24,7 +24,7 @@ "botbuilder": "^4.23.1", "dotenv": "^16.4.5", "jsonwebtoken": "^9.0.2", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/04.ai-apps/e.assistants-orderBot/package.json b/js/samples/04.ai-apps/e.assistants-orderBot/package.json index 88e867911..9f7cc8a31 100644 --- a/js/samples/04.ai-apps/e.assistants-orderBot/package.json +++ b/js/samples/04.ai-apps/e.assistants-orderBot/package.json @@ -24,7 +24,7 @@ "botbuilder": "^4.23.1", "dotenv": "^16.4.5", "jsonwebtoken": "^9.0.2", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/04.ai-apps/f.whoBot/package.json b/js/samples/04.ai-apps/f.whoBot/package.json index 78ea6e7f2..c620e9ad4 100644 --- a/js/samples/04.ai-apps/f.whoBot/package.json +++ b/js/samples/04.ai-apps/f.whoBot/package.json @@ -23,7 +23,7 @@ "botbuilder": "^4.23.1", "botbuilder-dialogs": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/04.ai-apps/g.datasource-azureAISearch/package.json b/js/samples/04.ai-apps/g.datasource-azureAISearch/package.json index 276e01426..89271ad30 100644 --- a/js/samples/04.ai-apps/g.datasource-azureAISearch/package.json +++ b/js/samples/04.ai-apps/g.datasource-azureAISearch/package.json @@ -32,7 +32,7 @@ "botbuilder": "^4.23.1", "debug": "^4.3.7", "dotenv": "^16.4.1", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0", "vectra": "^0.9.0" diff --git a/js/samples/04.ai-apps/h.datasource-azureOpenAI/package.json b/js/samples/04.ai-apps/h.datasource-azureOpenAI/package.json index 515671aa5..c8c7fd8a8 100644 --- a/js/samples/04.ai-apps/h.datasource-azureOpenAI/package.json +++ b/js/samples/04.ai-apps/h.datasource-azureOpenAI/package.json @@ -30,7 +30,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.1", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0", "vectra": "^0.9.0" diff --git a/js/samples/05.authentication/a.oauth-adaptiveCard/package.json b/js/samples/05.authentication/a.oauth-adaptiveCard/package.json index 54ae432d7..6403282f4 100644 --- a/js/samples/05.authentication/a.oauth-adaptiveCard/package.json +++ b/js/samples/05.authentication/a.oauth-adaptiveCard/package.json @@ -23,7 +23,7 @@ "@microsoft/teams-ai": "~1.5.2", "botbuilder": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "isomorphic-fetch": "^3.0.0", "replace": "~1.2.0", "restify": "~11.1.0" diff --git a/js/samples/05.authentication/b.oauth-bot/package.json b/js/samples/05.authentication/b.oauth-bot/package.json index d2e905de1..bae38b31e 100644 --- a/js/samples/05.authentication/b.oauth-bot/package.json +++ b/js/samples/05.authentication/b.oauth-bot/package.json @@ -23,7 +23,7 @@ "botbuilder": "^4.23.1", "botbuilder-dialogs": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/05.authentication/c.oauth-messageExtension/package.json b/js/samples/05.authentication/c.oauth-messageExtension/package.json index 96f050940..c7382e439 100644 --- a/js/samples/05.authentication/c.oauth-messageExtension/package.json +++ b/js/samples/05.authentication/c.oauth-messageExtension/package.json @@ -24,7 +24,7 @@ "botbuilder": "^4.23.1", "dotenv": "^16.4.5", "isomorphic-fetch": "^3.0.0", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0" }, diff --git a/js/samples/05.authentication/d.teamsSSO-bot/package.json b/js/samples/05.authentication/d.teamsSSO-bot/package.json index 3b38f1f7c..a056b3a2d 100644 --- a/js/samples/05.authentication/d.teamsSSO-bot/package.json +++ b/js/samples/05.authentication/d.teamsSSO-bot/package.json @@ -23,7 +23,7 @@ "botbuilder": "^4.23.1", "botbuilder-dialogs": "^4.23.1", "dotenv": "^16.4.5", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0", "shx": "^0.3.4" diff --git a/js/samples/05.authentication/e.teamsSSO-messageExtension/package.json b/js/samples/05.authentication/e.teamsSSO-messageExtension/package.json index ac0350575..dd1e84df1 100644 --- a/js/samples/05.authentication/e.teamsSSO-messageExtension/package.json +++ b/js/samples/05.authentication/e.teamsSSO-messageExtension/package.json @@ -25,7 +25,7 @@ "botbuilder-azure-blobs": "^4.23.1", "dotenv": "^16.4.5", "isomorphic-fetch": "^3.0.0", - "openai": "4.61.0", + "openai": "4.68.2", "replace": "~1.2.0", "restify": "~11.1.0", "shx": "^0.3.4" diff --git a/js/yarn.lock b/js/yarn.lock index b25b41462..a0ad23d56 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -2122,7 +2122,7 @@ botbuilder@^4.23.1: uuid "^10.0.0" zod "^3.23.8" -botframework-connector@4.23.1, botframework-connector@^4.23.0: +botframework-connector@4.23.1, botframework-connector@^4.23.1: version "4.23.1" resolved "https://registry.yarnpkg.com/botframework-connector/-/botframework-connector-4.23.1.tgz#060cce789cb57deedc657d136b00f318b8a2ef17" integrity sha512-UqOdVndOGNN1dgtLEKDD1rObPPI32tPwyrtU8WDuVukaPSL7KYp6z1SjudZ9ywDcrt5z+Rkbz2kGzaSidCVZWA== @@ -2148,7 +2148,7 @@ botframework-connector@4.23.1, botframework-connector@^4.23.0: stream-http "^3.2.0" zod "^3.23.8" -botframework-schema@4.23.1, botframework-schema@^4.23.0: +botframework-schema@4.23.1, botframework-schema@^4.23.1: version "4.23.1" resolved "https://registry.yarnpkg.com/botframework-schema/-/botframework-schema-4.23.1.tgz#e58118194085a3fcf67adbd92b38b43981794f7c" integrity sha512-J/cjL9IFewO3Q2yuV+QGtWyzVFPgKCp/3adY5/+0MrBQasJS5IIGm45W4CV/uYuoAstOIpYJ9nQPzvNWbDN16g== @@ -2157,7 +2157,7 @@ botframework-schema@4.23.1, botframework-schema@^4.23.0: uuid "^10.0.0" zod "^3.23.8" -botframework-streaming@4.23.1, botframework-streaming@^4.23.0: +botframework-streaming@4.23.1, botframework-streaming@^4.23.1: version "4.23.1" resolved "https://registry.yarnpkg.com/botframework-streaming/-/botframework-streaming-4.23.1.tgz#271db2b5f75ea929fc17832f3b4003eb3179d415" integrity sha512-/BjIu2BR8y/HOdJ+Wdr1nZUvW2W53G8whH65msvM95kmjEyqskeEWP62xDpZLA1OM3sLD9APNix69BX1awcbdw== diff --git a/python/packages/ai/teams/ai/ai.py b/python/packages/ai/teams/ai/ai.py index e108a01fe..52f00b368 100644 --- a/python/packages/ai/teams/ai/ai.py +++ b/python/packages/ai/teams/ai/ai.py @@ -304,7 +304,7 @@ async def _on_say_command( position=f"{i + 1}", appearance=Appearance( name=citation.title or f"Document {i + 1}", - abstract=snippet(citation.content, 480), + abstract=snippet(citation.content, 477), ), ) )