Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/nuget/dotnet/packages/Microsoft.T…
Browse files Browse the repository at this point in the history
…eamsAI/production-bcf7ed9ef1
  • Loading branch information
singhk97 authored Dec 9, 2024
2 parents 178ddca + ecfdb0a commit 9a2fa35
Show file tree
Hide file tree
Showing 51 changed files with 2,308 additions and 1,621 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ jobs:
name: testresults-dotnet-${{ matrix.dotnet-version }}
path: ${{ env.SOLUTION_DIR }}TestResults
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
4 changes: 2 additions & 2 deletions .github/workflows/dotnet-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
languages: csharp
- name: Setup .NET
Expand All @@ -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@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
category: "/language:csharp"
2 changes: 1 addition & 1 deletion .github/workflows/js-build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:
- name: Lint
run: yarn lint
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
4 changes: 2 additions & 2 deletions .github/workflows/js-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
category: "/language:javascript"
2 changes: 1 addition & 1 deletion .github/workflows/python-build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ jobs:
run: |
python scripts/lint.py
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
4 changes: 2 additions & 2 deletions .github/workflows/python-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
category: "/language:python"
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
sarif_file: results.sarif
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ public TeamsAdapter(
CredentialsFactory = new ConfigurationServiceClientCredentialFactory(configuration);
}

/// <summary>
/// Initializes a new instance of the <see cref="TeamsAdapter"/> class.
/// </summary>
/// <param name="configuration">The <see cref="IConfiguration"/> instance.</param>
/// <param name="credentialsFactory">The <see cref="ServiceClientCredentialsFactory"/> instance.</param>
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> this adapter should use.</param>
/// <param name="logger">The <see cref="ILogger"/> implementation this adapter should use.</param>
public TeamsAdapter(
IConfiguration configuration,
ServiceClientCredentialsFactory credentialsFactory,
IHttpClientFactory? httpClientFactory = null,
ILogger? logger = null) : base(
new ConfigurationBotFrameworkAuthentication(configuration,
credentialsFactory: credentialsFactory,
httpClientFactory: new TeamsHttpClientFactory(httpClientFactory),
logger: logger),
logger)
{
HttpClientFactory = new TeamsHttpClientFactory(httpClientFactory);
Configuration = configuration;
CredentialsFactory = credentialsFactory;
}

/// <inheritdoc />
public new async Task ProcessAsync(HttpRequest httpRequest, HttpResponse httpResponse, IBot bot, CancellationToken cancellationToken = default)
{
Expand Down
5 changes: 3 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@types/lodash": "^4.17.13",
"@types/mocha": "^10.0.9",
"@types/node": "^20.16.1",
"@types/sinon": "^10.0.19",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"applicationinsights": "^2.9.6",
Expand All @@ -47,6 +47,7 @@
"eslint-plugin-prettier": "^5.2.1",
"exorcist": "^2.0.0",
"express": "^4.21.1",
"mocha": "^10.7.3",
"mocha-junit-reporter": "^2.0.0",
"mocha": "^10.8.2",
"ms-rest-azure": "^3.0.2",
Expand All @@ -58,7 +59,7 @@
"replace-in-file": "^4.1.0",
"rimraf": "^5.0.10",
"shx": "^0.3.4",
"sinon": "^16.1.3",
"sinon": "^19.0.2",
"source-map-support": "^0.5.19",
"sponge": "^0.1.0",
"tinyify": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions js/packages/teams-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"openai": "^4.68.2"
},
"dependencies": {
"@azure/openai-assistants": "1.0.0-beta.6",
"@azure/msal-node": "^2.16.1",
"axios": "^1.7.5",
"botbuilder-dialogs": "^4.23.1",
Expand Down Expand Up @@ -72,7 +71,8 @@
"test": "npx mocha -r ts-node/register src/**/*.spec.ts",
"test:debug": "ts-mocha src/**/*.spec.ts --inspect-brk",
"test:coverage": "nyc --reporter=html --reporter=text --reporter=text-summary npm test",
"test:compat": "npx api-extractor run --verbose"
"test:compat": "npx api-extractor run --verbose",
"watch": "tsc -b --watch"
},
"files": [
"_ts3.4",
Expand Down
19 changes: 17 additions & 2 deletions js/packages/teams-ai/src/AI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export interface AIOptions<TState extends TurnState> {
* https://github.com/microsoft/teams-ai/blob/main/getting-started/CONCEPTS/POWERED-BY-AI.md
*/
enable_feedback_loop?: boolean;

/**
* Optional. Only used when `enable_feedback_loop` == `true`. When set to `custom` the user will be presented with a text input
* to provide feedback.
*/
feedback_loop_type?: 'default' | 'custom';
}

/**
Expand Down Expand Up @@ -104,6 +110,12 @@ export interface ConfiguredAIOptions<TState extends TurnState> {
* If true, the AI system will enable the feedback loop in Teams that allows a user to give thumbs up or down to a response.
*/
enable_feedback_loop: boolean;

/**
* Optional. Only used when `enable_feedback_loop` == `true`. When set to `custom` the user will be presented with a text input
* to provide feedback.
*/
feedback_loop_type?: 'default' | 'custom';
}

/**
Expand All @@ -121,7 +133,7 @@ export class AI<TState extends TurnState = TurnState> {
* A text string that can be returned from an action to stop the AI system from continuing
* to execute the current plan.
* @remarks
* This command is incompatible and should not be used with `tools` augmentation
* This command is incompatible and should not be used with `tools` augmentation
*/
public static readonly StopCommandName = actions.StopCommandName;

Expand Down Expand Up @@ -225,8 +237,11 @@ export class AI<TState extends TurnState = TurnState> {
this.defaultAction(AI.HttpErrorActionName, actions.httpError());
this.defaultAction(AI.PlanReadyActionName, actions.planReady());
this.defaultAction(AI.DoCommandActionName, actions.doCommand());
this.defaultAction(AI.SayCommandActionName, actions.sayCommand(this._options.enable_feedback_loop));
this.defaultAction(AI.TooManyStepsActionName, actions.tooManySteps());
this.defaultAction(AI.SayCommandActionName, actions.sayCommand(
this._options.enable_feedback_loop,
this._options.feedback_loop_type || 'default'
));
}

/**
Expand Down
Loading

0 comments on commit 9a2fa35

Please sign in to comment.