Help with migration OpenAi Assistant #12637
-
Hi team We have been trying to migrate from SK 1.3x to the latest version, and we hit a wall :( We use C # and the OpenAI assistant. In all your examples https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/GettingStartedWithAgents/OpenAIAssistant, you show multiple conversations that happen sequentially, it would be amazing if someone could give a brief example of how to continue a conversation in the web world where
How to get AgentThread based on a saved ThreadId that is a string AssistantClient - has a GetThreadAsync(threadId) - but this method returns AssistantThread - how to get AgentThread? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Refer to this documentation page for guidance: OpenAIAssistantAgent C# Migration Guide |
Beta Was this translation helpful? Give feedback.
-
Adding @westey-m who may be able to help as well for the .NET side (if there are further questions after referring to the migration guide). |
Beta Was this translation helpful? Give feedback.
-
Thank you so much @rogeriorfp - I wasn't able to find the upgrade. @westey-m, it would be great if the examples had a more web-like approach where a user sends a request and we create an agent, thread (as it is in your examples), but then the user sends a follow-up question with, e.g., an attached file. So this is not happening in the same function as in your code, one after another - as the user can ask this question 5 days later, we need to recreate the whole process again. Of course, it is our implementation how the user, threadId is saved - what I'm looking for is:
How to handle this now? |
Beta Was this translation helpful? Give feedback.
Hey @JP-droidic, when using an OpenAIAssistantAgent, it works with an OpenAIAssistantAgentThread and it inherits from AgentThread. The idea here is that users can use the Agent abstraction without needing to worry about the differences in threading between different agents.
OpenAIAssistantAgentThread has an Id property that contain the id of the underlying OpenAI assistant agent thread. You can also construct a new OpenAIAssistantThread using an existing Id if you want to continue an existing conversation, using this constructor:
public OpenAIAssistantAgentThread(AssistantClient client, string id)
If you want to have custom logic outside of the abstraction that manipulates threads like yo…