microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.96k stars 3.27k forks source link

Asynchronous flow with semantic kernel #9176

Open denniseng88 opened 1 month ago

denniseng88 commented 1 month ago

Hello, in some of my kernel functions, the APIs I call trigger some asynchronous operations in the background. So, I need to check the result of operations from another source. Thats why, I shouldn’t proceed to the next step until I see that the async operation’s status is ‘done.’ However, when I write my requirement, the semantic kernel suggests the steps we should follow, and naturally, it calls all the steps consecutively, which results in the next process being executed before the async operation is completed. I need to check the async operations status with a separate process and need to trigger flow again with a prompt like “continue” when it is completed. So I can’t write a kernel function for querying the result of job. In this case, what would be the best way to run the semantic kernel for this asynchronous flow? Thank you in advance.

moonbox3 commented 1 month ago

Hello @denniseng88, thanks for your question. Are you targeting .Net, Python, or Java? If you are targeting .Net, have you tried using our new Process Framework? Link: https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/GettingStartedWithProcesses. The Python Process Framework will be launched in the coming weeks.

mickaelropars commented 1 month ago

@moonbox3 can we use the Process in .NET? or is there any major changes that will be implemented ?

moonbox3 commented 1 month ago

@mickaelropars the process framework is experimental and still under development, so please keep that in mind. We're not trying to introduce large, breaking changes, and most features should be additive. But, again, it is experimental. :)

mickaelropars commented 1 month ago

@moonbox3 Thanks a lot Evan, I will keep an eye on it . is it plan to mix agent and process framework? because as far as I saw it only some kernel function that are called (Maybe I didn't take into account all the process framework features).

markwallace-microsoft commented 1 month ago

Hi @denniseng88 can you provide for details on the scenario that isn't working for you?

We have support for calling Open API endpoints which are async calls. SK will await the responses and return these to the model so it can take it's next step and potentially respond t the user. SK will detect async scenarios for function calling and also prompt rendering.

moonbox3 commented 1 month ago

@moonbox3 Thanks a lot Evan, I will keep an eye on it . is it plan to mix agent and process framework? because as far as I saw it only some kernel function that are called (Maybe I didn't take into account all the process framework features).

You're welcome. We are working on some process samples that will show how to include the agent framework right now and they should be ready soon. Will keep you posted.

mickaelropars commented 1 month ago

Marvelous