Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] fix: Remove [] intializer notation #2232

Merged
merged 23 commits into from
Dec 11, 2024
Merged

[C#] fix: Remove [] intializer notation #2232

merged 23 commits into from
Dec 11, 2024

Conversation

singhk97
Copy link
Collaborator

Linked issues

closes: #minor

Details

remove [] notation because it is not supported in version < C#12. That includes .NET 6 which is a framework we target.

Attestation Checklist

  • 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

singhk97 and others added 22 commits October 17, 2024 09:35
## Linked issues

closes: #2103 

## Details
Added support for `o1-preview` and `o1-mini` models.

* Bumped `OpenAI` and `Azure.AI.OpenAI` to `2.1.0-beta.1`.
* Tested o1 support with light bot sample with monologue augmentation.
* Updated `teamsChefBot-streaming` to use deployed `Microsoft.Teams.AI`
nuget package.
* Fixed `LayoutSection` bug with incorrect ordering of sections.

## 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
#2122)

## Linked issues

closes: #minor

## Details
Exceptions thrown in `DrainQueue()` are being supressed as the method
runs on a worker thread and the corresponding `Task` is never resolved
by the main thread.

With the fix, when `this._queueSync` is awaited in `EndStream()`, an
exception will be thrown if the corresponding `Task` is faulted (i.e. an
exception is thrown from `DrainQueue()`.

#### Change details
* Removed code that sets `this._queueSync` to null when queue is empty.
This means that `this._queueSync` can be either null or assigned a Task
at any given time.
* If `this._queueSync` is not null then an additional check
`this._queueSync.isTaskCompleted` is made to check whether `DrainQueue`
Task has completed or not.

If streaming operation fails, the exception will be thrown:


![image](https://github.com/user-attachments/assets/403b6003-7df4-4684-b433-dd507b91cb4c)


## 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
## Linked issues

closes: #minor

## Details
Deprecated public preview of azure content safety moderator.

#### Change details
* Updated `Azure.AI.ContentSafety` to `v1.0.0`
* Added chat moderation sample

## 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
…ror Propagation, Entities Metadata (#2139)

## Linked issues

closes: #1970

## Details

- Added temporary 1.5 second buffer to adhere to 1RPS backend service
requirement
- Added support for Feedback Loop
- Added support for Generated by AI label
- Added reject/catch handling for errors
- Added entities metadata to match GA requirements

**screenshots**:

![image](https://github.com/user-attachments/assets/78eb652e-65c2-4544-9e30-36d656a8a9e3)


## 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

---------

Co-authored-by: lilydu <[email protected]>
## Linked issues

closes: #1970

## Details

This will work slightly differently than the previous non-streaming Plan
flow. Citations and its respective sensitivity labels are added per each
text chunk queued. However, these will only be rendered in the final
message (when the full message has been received).

Rather than exposing the SensitivityUsageInfo object as an override on
the PredictedSayCommand, the label can now be directly set as usageInfo
in the AIEntity object along with the AIGenerated label and the
citations.

**screenshots**:

![image](https://github.com/user-attachments/assets/81c0f3dd-f958-4b4b-8cbf-56bf36f24f78)


## 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

---------

Co-authored-by: lilydu <[email protected]>
#2150)

## Linked issues

closes: #minor

## Details
The `OpenAI` sdk automatically maps the `max_tokens` configuration to
the `MaxOutputTokenCount` property (i.e `max_completion_tokens`).
However this does not work with Azure OpenAI service as it expects
`max_tokens` for non-o1 models.

#### Change details
* In `OpenAIModel.cs` if the model is not in the o1 series, then use
`max_tokens` field by default.

## 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
## Linked issues

closes: #minor

## Details

* Bump `Microsoft.Teams.AI` to version 1.8.0
* Update all the samples to point to this version.

## 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
## Linked issues

closes: #minor

## Details
for `entities` object, update `streamType` enum conversion to string
instead of int

## 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
… calls (#2214)

## Linked issues

closes: #2098

## Details

Port the streaming support for tools augmentation to C#.

#### Change details

- Added StreamingChatToolCallsBuilder and SequenceBuilder helper
classes.
- Updated OpenAIModel class to process tool call chunks and return them
as a message with ActionCalls.
- Updated the LLMClient class to pass through the ActionCalls without
closing the streaming response session.


**code snippets**:

**screenshots**:

## Attestation Checklist

- [ ] 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

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: kavin <[email protected]>
Co-authored-by: Lily Du <[email protected]>
Co-authored-by: lilydu <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Corina <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Alex Acebo <[email protected]>
## Linked issues

closes: #minor (issue number)

## Details
- Bumping `JsonSchema` to v6.1.2 so that it uses `Json.More.Net` version
2.x
- Fixed a test failure in a previous PR (.net build was not run)

#### Change details
_Exception_
```
Microsoft.Teams.AI.Exceptions.TeamsAIException: Error while loading prompt. Method not found: \u0027!!0 Json.More.JsonSerializerOptionsExtensions.Read(System.Text.Json.JsonSerializerOptions, System.Text.Json.Utf8JsonReader ByRef)\u0027.\r\n   at Microsoft.Teams.AI.AI.Prompts.PromptManager._LoadPromptTemplateFromFile(String name)\r\n   at Microsoft.Teams.AI.AI.Prompts.PromptManager.GetPrompt(String name)\r\n   at Program.\u003C\u003Ec__DisplayClass0_1.\u003C\u003C\u003CMain\u003E$\u003Eb__14\u003Ed.MoveNext() in C:\\TFS\\Icertis.AI.M365Copilot\\Icertis.AI.M365Copilot.App\\Program.cs:line 148\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.Teams.AI.AI.Planners.ActionPlanner\u00601.ContinueTaskAsync(ITurnContext context, TState state, AI\u00601 ai, CancellationToken cancellationToken)\r\n   at Microsoft.Teams.AI.AI.Planners.ActionPlanner\u00601.BeginTaskAsync(ITurnContext context, TState state, AI\u00601 ai, CancellationToken cancellationToken)\r\n   at Microsoft.Teams.AI.AI.AI\u00601.RunAsync(ITurnContext turnContext, TState turnState, Nullable\u00601 startTime, Int32 stepCount, CancellationToken cancellationToken)\r\n   at Microsoft.Teams.AI.Application\u00601._OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)\r\n   at Microsoft.Teams.AI.Application\u00601.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)\r\n   at Microsoft.Teams.AI.Application.Authentication.Bot.FilteredTeamsSSOTokenExchangeMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken)\r\n   at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)\r\n   at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
```

## 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
## Linked issues

closes: #minor (issue number)

## Details
- bump .NET sdk to v1.9.0
- bump AdaptiveCards.Templating to v2.x
#### Change details

> Describe your changes, with screenshots and code snippets as
appropriate

**code snippets**:

**screenshots**:

## 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
@corinagum
Copy link
Collaborator

Is there a reason why there are so many commits within the PR?

@singhk97
Copy link
Collaborator Author

singhk97 commented Dec 11, 2024

Is there a reason why there are so many commits within the PR?

Because I'm reusing the dotnet-dev branch.

Copy link
Collaborator

@corinagum corinagum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

@singhk97 singhk97 merged commit 9292bb8 into main Dec 11, 2024
11 checks passed
@singhk97 singhk97 deleted the dotnet-dev branch December 11, 2024 21:49
@singhk97 singhk97 restored the dotnet-dev branch December 11, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants