From f02e5bdd2cc794c1392340ccb44e75e8413fa884 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:22:14 -0800 Subject: [PATCH 1/2] [repo] bump: (deps): Bump the production group with 2 updates (#2305) #minor Bumps the production group with 2 updates: [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/reportgenerator-github-action) and [github/codeql-action](https://github.com/github/codeql-action). Updates `danielpalme/ReportGenerator-GitHub-Action` from 5.4.3 to 5.4.4
Release notes

Sourced from danielpalme/ReportGenerator-GitHub-Action's releases.

5.4.4

Commits

Updates `github/codeql-action` from 3.28.8 to 3.28.9
Release notes

Sourced from github/codeql-action's releases.

v3.28.9

CodeQL Action Changelog

See the releases page for the relevant changes to the CodeQL CLI and language packs.

3.28.9 - 07 Feb 2025

See the full CHANGELOG.md for more information.

Changelog

Sourced from github/codeql-action's changelog.

CodeQL Action Changelog

See the releases page for the relevant changes to the CodeQL CLI and language packs.

[UNRELEASED]

No user facing changes.

3.28.9 - 07 Feb 2025

3.28.8 - 29 Jan 2025

3.28.7 - 29 Jan 2025

No user facing changes.

3.28.6 - 27 Jan 2025

3.28.5 - 24 Jan 2025

3.28.4 - 23 Jan 2025

No user facing changes.

3.28.3 - 22 Jan 2025

3.28.2 - 21 Jan 2025

No user facing changes.

3.28.1 - 10 Jan 2025

3.28.0 - 20 Dec 2024

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/coverage.yml | 2 +- .github/workflows/dotnet-build-test-lint.yml | 2 +- .github/workflows/dotnet-codeql.yml | 4 ++-- .github/workflows/js-codeql.yml | 4 ++-- .github/workflows/python-codeql.yml | 4 ++-- .github/workflows/scorecards.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a9b03b6ed..2b330c3f0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -71,7 +71,7 @@ jobs: - name: Test run: dotnet test Microsoft.TeamsAI.Tests/Microsoft.Teams.AI.Tests.csproj --verbosity normal --logger trx --results-directory ./TestResults --collect:"XPlat Code Coverage" --configuration Release - name: Coverage - uses: danielpalme/ReportGenerator-GitHub-Action@c38c522d4b391c1b0da979cbb2e902c0a252a7dc # 5.4.3 + uses: danielpalme/ReportGenerator-GitHub-Action@f1927db1dbfc029b056583ee488832e939447fe6 # 5.4.4 with: reports: ${{ env.SOLUTION_DIR }}TestResults/*/coverage.cobertura.xml targetdir: ${{ env.SOLUTION_DIR }}TestResults/coverage diff --git a/.github/workflows/dotnet-build-test-lint.yml b/.github/workflows/dotnet-build-test-lint.yml index cd207407a..d9caadcc6 100644 --- a/.github/workflows/dotnet-build-test-lint.yml +++ b/.github/workflows/dotnet-build-test-lint.yml @@ -43,7 +43,7 @@ jobs: - name: Test run: dotnet test Microsoft.TeamsAI.Tests/Microsoft.Teams.AI.Tests.csproj --no-restore --verbosity normal --logger trx --results-directory ./TestResults --collect:"XPlat Code Coverage" --configuration Release - name: Coverage - uses: danielpalme/ReportGenerator-GitHub-Action@c38c522d4b391c1b0da979cbb2e902c0a252a7dc # 5.4.3 + uses: danielpalme/ReportGenerator-GitHub-Action@f1927db1dbfc029b056583ee488832e939447fe6 # 5.4.4 with: reports: ${{ env.SOLUTION_DIR }}TestResults/*/coverage.cobertura.xml targetdir: ${{ env.SOLUTION_DIR }}TestResults/coverage diff --git a/.github/workflows/dotnet-codeql.yml b/.github/workflows/dotnet-codeql.yml index 279759660..05e33cc5c 100644 --- a/.github/workflows/dotnet-codeql.yml +++ b/.github/workflows/dotnet-codeql.yml @@ -39,7 +39,7 @@ jobs: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: languages: csharp - name: Setup .NET @@ -50,6 +50,6 @@ jobs: working-directory: dotnet/packages/Microsoft.TeamsAI/ run: dotnet build Microsoft.Teams.AI.sln --configuration Release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: category: "/language:csharp" diff --git a/.github/workflows/js-codeql.yml b/.github/workflows/js-codeql.yml index 489c92606..be13fb90f 100644 --- a/.github/workflows/js-codeql.yml +++ b/.github/workflows/js-codeql.yml @@ -38,10 +38,10 @@ jobs: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: languages: javascript - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: category: "/language:javascript" diff --git a/.github/workflows/python-codeql.yml b/.github/workflows/python-codeql.yml index 7889ac0cf..8f3792b11 100644 --- a/.github/workflows/python-codeql.yml +++ b/.github/workflows/python-codeql.yml @@ -38,10 +38,10 @@ jobs: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: languages: python - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: category: "/language:python" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 0978a8984..e16f7ea6f 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -66,6 +66,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: sarif_file: results.sarif From 549de97de7732c20d25bc395c93d6f6e8457d711 Mon Sep 17 00:00:00 2001 From: Lily Du Date: Tue, 18 Feb 2025 12:06:43 -0800 Subject: [PATCH 2/2] [repo] chore: update streaming docs with custom use (#2312) ## Linked issues closes: #2302 ## Details update docs for customers interested in managing their own `StreamingResponse` class instance --------- Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> --- getting-started/CONCEPTS/STREAMING.md | 75 ++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/getting-started/CONCEPTS/STREAMING.md b/getting-started/CONCEPTS/STREAMING.md index a9894fcb9..c7bd293da 100644 --- a/getting-started/CONCEPTS/STREAMING.md +++ b/getting-started/CONCEPTS/STREAMING.md @@ -42,7 +42,7 @@ There are three parts to streaming: - [Python Streaming+Tools LightBot](https://github.com/microsoft/teams-ai/tree/main/python/samples/04.ai.c.actionMapping.lightBot) ## Streaming Response Class -The `StreamingResponse` class is the helper class for streaming responses to the client. The class is used to send a series of updates to the client in a single response. If you are using your own custom model, you can directly instantiate and manage this class to stream responses. +The `StreamingResponse` class is the helper class for streaming responses to the client. The class is used to send a series of updates to the client in a single response. The expected sequence of calls is: @@ -52,6 +52,8 @@ The expected sequence of calls is: Once `endStream()` is called, the stream is considered ended and no further updates can be sent. +If you are using your own custom model, you can directly instantiate and manage this class to stream responses. The instructions for this scenario are specified below, though we encourage you to read through this to its entirety to understand the complete flow. + ## Configuration with Azure Open AI / Open AI @@ -208,6 +210,77 @@ planner=ActionPlanner( ``` +## Custom `StreamingResponse` Management + +### Definitions + +- **Stream ID**: A unique identifier for the stream, assigned after the initial update is sent. It ensures that all subsequent messages are associated with the correct stream. +- **Sequence Numbers**: Each message in the stream is assigned a sequence number (`streamSequence`), starting from 1 and incrementing with each message. This helps maintain the order of messages. + + +The class also maintains an internal queue for outgoing activities to ensure they are sent in order and without overloading the Teams client. + +### Implementation + +#### 1. Initialize `StreamingResponse` + +To start using the `StreamingResponse` class, you need to create an instance of it within your bot's turn handler. + + ```javascript + const streamingResponse = new StreamingResponse(context); + ``` + + +#### 2. Send Informative Updates + + ```javascript + streamingResponse.queueInformativeUpdate('Searching for the information you requested...'); + ``` + +#### 3. Queuing Text Chunks + +As your bot generates or retrieves content, you can send partial messages to the user. + +**Note 1**: As we do not handle chunking, this class assumes you already have some form of chunking mechanism (e.g., via another LLM) prior to using this class. +The streaming behaviour is determined through the timeouts and the size of the text chunks. + +**Note 2**: It is important to include a delay between the chunks to avoid spamming the Teams Client. + + ```javascript + const firstChunk = 'Here is the first part of the information.'; + const secondChunk = 'Continuing with more details...'; + + streamingResponse.queueTextChunk(firstChunk); + + // Delay between chunks, minimum 1000ms + await new Promise(resolve => setTimeout(resolve, 1500)); + + streamingResponse.queueTextChunk(secondChunk); + ``` + +#### 4. Ending the Stream + +Call the `endStream` method to conclude the stream. Since this method returns a promise, use `await` to ensure all queued activities are sent before proceeding. + + + ```javascript + await streamingResponse.endStream(); + ``` + +### Extra Features + +You may also be interested in adding in the [Powered by AI](./POWERED-BY-AI.md) features. + +To configure the Feedback Loop, use the `setFeedbackLoop` and `setFeedbackLoopType` methods. + +To configure the Generated by AI button, use the `setGeneratedByAILabel` method. + +To configure the Sensitivity Label, use the `setSensitivityLabel` method. + +To configure citations, use the `setCitations` method. Please see the ClientCitation interface in the Teams AI library for the expected shape of the citation object. + +To configure attachments, use the `setAttachments` method. Note that this is only currently rendered for the final chunk. + --- ## Return to other major section topics: