microsoft / teams-ai

SDK focused on building AI based applications and extensions for Microsoft Teams and other Bot Framework channels
MIT License
407 stars 176 forks source link

[Feat]: add support for AI assistants=v2 version API #1585

Open xiaolang124 opened 5 months ago

xiaolang124 commented 5 months ago

Language

Javascript/Typescript

Version

latest

Description

It appears that users cannot change the OpenAI assistant's API version, as Teams AI is currently utilizing version 4.28.4 of the OpenAI npm package, with its assistant's API version set to v1. Will you update this OpenAI npm package to the latest version, or how can we change the assistant's API version?

image

Related bug: https://github.com/OfficeDev/TeamsFx/issues/11512

Reproduction Steps

...
### Tasks
- [x] C#
- [x] PY
- [ ] JS
smithcal1000 commented 5 months ago

OpenAI Assistant API version is hard-coded in a few files. I am using Microsoft Visual Studio. For example, this C# file also has v1 hard-coded in the threads API endpoint -> teams-ai/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/OpenAI/OpenAIClient.Thread.cs OpenAIThreadAPIversionhardcoded

Valentinoaa commented 5 months ago

Hi, I´m facing the same issue, but you don´t have to change the v1 in the endpoint, just change the header, check the OpenAI documentation: image

OpenAI Assistant API version is hard-coded in a few files. I am using Microsoft Visual Studio. For example, this C# file also has v1 hard-coded in the threads API endpoint -> teams-ai/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/AI/OpenAI/OpenAIClient.Thread.cs OpenAIThreadAPIversionhardcoded

smithcal1000 commented 4 months ago

@Valentinoaa Thank you, but how can you change the version number in the header when using the Teams AI Library provided by Microsoft to create an AI assistant bot [Preview] Teams app in Microsoft Visual Studio or VS Code?

Valentinoaa commented 4 months ago

@smithcal1000, you´re wellcome. I´ve pulled an example from the TeamsAI repo in Python and I´ve fixed it installing the latest OpenAI version (running pip install openai=1.27.00), maybe you´ll have to modify some lines (including the dependencies). You can check how to migrate here.

smithcal1000 commented 4 months ago

I just checked and Microsoft has not yet released the Azure.AI.OpenAI.Assistants package that supports streaming and Assistants v2. It says it will be coming soon in a future update.

Valentinoaa commented 4 months ago

I just checked and Microsoft has not yet released the Azure.AI.OpenAI.Assistants package that supports streaming and Assistants v2. It says it will be coming soon in a future update.

Check this example. I´m using it and it works well. You just have to migrate manually to the latest OpenAI SDK as I mentioned before.

ahmedmahmoudR commented 4 months ago

I just checked and Microsoft has not yet released the Azure.AI.OpenAI.Assistants package that supports streaming and Assistants v2. It says it will be coming soon in a future update.

Check this example. I´m using it and it works well. You just have to migrate manually to the latest OpenAI SDK as I mentioned before.

I tried your solution, and it works after I manually installed the latest OpenAI SDK. However, can I do the same with JS instead of Python?

stuart-pebble commented 2 months ago

Did you manage to get this working with JavaScript?

And if so did you need to modified any code / headers etc?

corinagum commented 2 months ago

Since assistants in OpenAI are still beta, this feature request is in our backlog and not being prioritized at the moment. Please feel free to share here any code as workarounds for others to take advantage of :)

stuart-pebble commented 2 months ago

The objective of the update is to update the API calls to the OpenAI Assistant to V2 in the hope that this would then have the interactions with the Assistant use its local vector store for context. It currently “works” for chat but is useless without the context. Nearly brilliant.

I’ve investigated making the updates to teams-ai myself but its beyond my skill levels, even with an arm of AI tools. I might be able to butcher it but it would likely break everything else and not aligned with the teams-ai objectives.

For now, I’ll have to use an alternative to Teams keep an eye on the project and circle back when support is added. I’ll be happy to beta test something when its available.

Thanks for driving the project, I really think Teams is a great way to enable AI adoption by bringing AI to where users work everyday.

From: Corina @.> Date: Wednesday, 24 July 2024 at 4:40 AM To: microsoft/teams-ai @.> Cc: Stuart Hirst @.>, Comment @.> Subject: Re: [microsoft/teams-ai] [Feat]: add support for AI assistants=v2 version API (Issue #1585)

Since assistants in OpenAI are still beta, this feature request is in our backlog and not being prioritized at the moment. Please feel free to share here any code as workarounds for others to take advantage of :)

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/teams-ai/issues/1585#issuecomment-2245976709, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJ4HB4MDRO3CNEZLGRRDXR3ZN2PR3AVCNFSM6AAAAABG74F226VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBVHE3TMNZQHE. You are receiving this because you commented.Message ID: @.***>

singhk97 commented 1 month ago

Python & C# have been updated to support leaving only JS that needs to be brought to parity.

stuart-pebble commented 1 month ago

Looking like good progress. Just an FYI that when using the VSCode MS Teams Toolkit, the only options when choosing "Build with Assistants API" is JavaScript and TypeScript. Looking forward to the JS updates :-)

darcohen commented 1 month ago

Looking like good progress. Just an FYI that when using the VSCode MS Teams Toolkit, the only options when choosing "Build with Assistants API" is JavaScript and TypeScript. Looking forward to the JS updates :-)

Seconding this - the V2 capabilities, especially File Search, are a game changer. Would love to implement through MS Teams Toolkit on JS.

stuart-pebble commented 2 weeks ago

Any progress with JS support?