Skip to content

How to ask the user for some information while executing a plan? #6014

Closed

Description

@rborosak

I'm trying out a FunctionCallingStepwisePlanner.


var _kernel = Kernel.CreateBuilder().AddOpenAIChatCompletion("gpt-3.5-turbo", openAiApiKey, openAiOrg).Build();
_kernel.Plugins.AddFromType<CinemaPlugin>();

while (true)
{
    Console.WriteLine("User > ");

    var userinput = Console.ReadLine();
    if (userinput == "exit")
        break;

#pragma warning disable SKEXP0060 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

    var planner = new FunctionCallingStepwisePlanner(new FunctionCallingStepwisePlannerOptions()
    {
        MaxIterations = 1
    });

    var result = await planner.ExecuteAsync(_kernel, userinput);

    var content = result.FinalAnswer;

    Console.WriteLine($"Assistant > {content}");

#pragma warning restore SKEXP0060 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
}

I have a plugin with a few methods that will be used to make a movie reservation.
The generated plan is ok:

Original request: how to make a movie reservation?

You are in the process of helping the user fulfill this request using the following plan:

Use CinemaPlugin-GetAvailableMovies function to get the list of available movies for the desired date.
Use CinemaPlugin-MakeReservation function to prepare a reservation for the selected movie, date, and number of seats.
Confirm the reservation by using CinemaPlugin-ConfirmReservation function with the selected movie, date, and number of seats.
Send the final answer to the user confirming the successful reservation using UserInteraction-SendFinalAnswer function.

The user will ask you for help with each step.

As you can see I have ask it how to make a reservation and it figured out how to do it but the FinalAnswer of the planner is an empty string.
What can I do to make it ask me for an input?
Since I have not provided a date for a movie it should ask me for a date. When the user provides a date it can call GetAvailableMovies function to get a list of the movies.
Now the user should pick one from the list. Since we have a date and a movie it can try to make a resevation etc.

Is this kind of scenario possible with planners?

Activity

  1. iBoonz commented on Apr 29, 2024

    @iBoonz

    +1 :), exact same question/scenario I have. Especially when the plan can contain OpenAI Plugins, which we don't know upfront which parameters are required

  2. locked and limited conversation to collaborators on Apr 30, 2024
  3. converted this issue into a discussion #6072 on Apr 30, 2024
  4. moved this from Sprint: In Review to Sprint: Done in Semantic Kernelon Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions