Skip to content

FunctionFlow behavior in plan object.#6

Closed
lemillermicrosoft wants to merge 4 commits intopom_plannerfrom
pom_planner_ff
Closed

FunctionFlow behavior in plan object.#6
lemillermicrosoft wants to merge 4 commits intopom_plannerfrom
pom_planner_ff

Conversation

@lemillermicrosoft
Copy link
Copy Markdown
Owner

dd planning functionality and tests to SemanticKernel project

  Summary: This commit adds several classes and methods to support planning functionality in the SemanticKernel project. It also adds unit and integration tests for the planning module and the skills involved in creating and executing plans. The main changes are:

  - Added a new class FunctionFlowParser that can parse XML plans created by the Function Flow semantic function. The parser converts the XML string into a SequentialPlan object that can be executed by the planner.
  - Added a new class PlannerConfig that encapsulates the common configuration options for planner instances, such as relevancy threshold, max tokens, and excluded or included functions.
  - Added a new class FunctionFlowPlanner that implements a planner that uses a semantic function to generate a step-by-step plan from a goal, using relevant functions from the kernel.
  - Added a new class SequentialPlan that represents a plan composed of sequential steps. The SequentialPlan class inherits from the Plan class and overrides the InvokeNextStepAsync method to execute the next function in the plan. The SequentialPlan class also has properties for storing the output and result keys of each step.
  - Added a new skill PlannerSkill that can execute a plan using the kernel's skills and context.
  - Added a new email skill that can send emails using the OpenAI completion backend. The email skill demonstrates how to use the context variables and named parameters in the plan steps.
  - Added two new extension methods to the SKContext class: GetFunctionsManualAsync and GetAvailableFunctionsAsync. These methods allow the user to query for functions that match a semantic query and a planner configuration, and to get a manual string for each function.
  - Added several unit tests for the planning functionality of the semantic kernel, covering different scenarios of creating and executing plans using different skills and functions.
  - Added several integration tests for the planning and email skills, covering different scenarios of creating and executing sequential plans that involve summarizing, translating, and sending emails.
  - Updated the Example12_Planning.cs file to demonstrate how to use the planning functionality with a simple web search example and a poetry writing and translating example. The file also demonstrates two different ways of using the planner skill: directly as a skill function, or as a planner class.
  - Imported some skills from the sample skills directory, such as WebSearchEngineSkill and SummarizeSkill.
  - Added some TODO comments and bug reports for the planning module.

Motivation and Context

Description

Contribution Checklist

/// </summary>
internal const string AppendToResultTag = "appendToResult";

internal static SequentialPlan ToPlanFromXml(this string xmlString, SKContext context)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

TODO - more testing and integration of Roger's Conditional work -- might need some help here.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Maybe we can just have Conditional stuff be their own Plan implementation that can be added to a SequentialPlan or other.

@lemillermicrosoft lemillermicrosoft force-pushed the pom_planner_ff branch 2 times, most recently from 8ded2b0 to 6b257aa Compare April 6, 2023 17:52
@lemillermicrosoft lemillermicrosoft changed the title [sq][build] function flow - ready for testing FunctionFlow behavior in plan object. Apr 7, 2023
@lemillermicrosoft
Copy link
Copy Markdown
Owner Author

TODO:

  • Merge with conditional work
  • Add tests for 'AppendToResult' behavior and add any missing functionality
  • Add tests for ensuring outputs
  • Design review
  • Major cleanup
  • More tests

dd planning functionality and tests to SemanticKernel project

      Summary: This commit adds several classes and methods to support planning functionality in the SemanticKernel project. It also adds unit and integration tests for the planning module and the skills involved in creating and executing plans. The main changes are:

      - Added a new class FunctionFlowParser that can parse XML plans created by the Function Flow semantic function. The parser converts the XML string into a SequentialPlan object that can be executed by the planner.
      - Added a new class PlannerConfig that encapsulates the common configuration options for planner instances, such as relevancy threshold, max tokens, and excluded or included functions.
      - Added a new class FunctionFlowPlanner that implements a planner that uses a semantic function to generate a step-by-step plan from a goal, using relevant functions from the kernel.
      - Added a new class SequentialPlan that represents a plan composed of sequential steps. The SequentialPlan class inherits from the Plan class and overrides the InvokeNextStepAsync method to execute the next function in the plan. The SequentialPlan class also has properties for storing the output and result keys of each step.
      - Added a new skill PlannerSkill that can execute a plan using the kernel's skills and context.
      - Added a new email skill that can send emails using the OpenAI completion backend. The email skill demonstrates how to use the context variables and named parameters in the plan steps.
      - Added two new extension methods to the SKContext class: GetFunctionsManualAsync and GetAvailableFunctionsAsync. These methods allow the user to query for functions that match a semantic query and a planner configuration, and to get a manual string for each function.
      - Added several unit tests for the planning functionality of the semantic kernel, covering different scenarios of creating and executing plans using different skills and functions.
      - Added several integration tests for the planning and email skills, covering different scenarios of creating and executing sequential plans that involve summarizing, translating, and sending emails.
      - Updated the Example12_Planning.cs file to demonstrate how to use the planning functionality with a simple web search example and a poetry writing and translating example. The file also demonstrates two different ways of using the planner skill: directly as a skill function, or as a planner class.
      - Imported some skills from the sample skills directory, such as WebSearchEngineSkill and SummarizeSkill.
      - Added some TODO comments and bug reports for the planning module.
 This commit makes several changes to the Plan class and its related classes and tests. It refactors the Plan class to use the new ISKFunction interface and the FunctionView class, and to improve the handling of function parameters and variables. It also adds a new method to set the function and name properties of the Plan class, and a new property to specify the output keys for each step. It removes the SequentialPlan class, which was no longer needed, and some unused or redundant code from the SequentialPlan.cs file. It updates the PlanTests class to use imported skills instead of hard-coded skill names and functions, and to use the new Plan constructor. It also fixes some minor formatting and naming issues, and adds some comments and assertions for clarity.

 TODO - tests about book scenario, appending results (or not).
/// <summary>
/// Common configuration for planner instances.
/// </summary>
public sealed class PlannerConfig
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I was on board for getting rid of planner skill, but now I see it more as Removing FunctionFlowRunner and replacing with FunctionFlowParser to take NL XML and convert to a Plan object and then rely on native kernel support for execution. The PlannerSkill can still expose this and use the FunctionFlowPlanner just like a developer could use directly, as well.

dehoward pushed a commit that referenced this pull request Jun 1, 2023
### Motivation and Context
Currently, semantic memory can only be added to directly through the
kernel. Users should be able to save information to semantic memory
using TextMemorySkill.

### Description
Added the semantic function `SaveAsync` to `TextMemorySkill.` 

Additionally updated `Example15_MemorySkill` to demonstrate how to use
the new functionality. I manually verified that the example output
remains unchanged.
dehoward pushed a commit that referenced this pull request Jun 1, 2023
Build and style fixes in OpenAPI skill (microsoft#297)
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.

1 participant