Skip to content

Latest commit

 

History

History
114 lines (91 loc) · 3.89 KB

PLANNER.md

File metadata and controls

114 lines (91 loc) · 3.89 KB

Planner

Navigation


The planner receives the user's ask and returns a plan on how to accomplish the request. The user's ask is in the form of a prompt or prompt template. It does this by using AI to mix and match atomic functions (called actions) registered to the AI system so that it can recombine them into a series of steps that complete a goal.

This is a powerful concept because it allows you to create actions that can be used in ways that you as a developer may not have thought of.

For instance, If you have a task with Summarize & SendEmail actions, the planner could combine them to create workflows like "Rewrite the following report into a short paragraph and email it to [email protected]" without you explicitly having to write code for those scenarios.

The planner is an extensible part of the AI system. This means that a custom planner can be created for your specific needs. Out of the box, the Teams AI library supports the following planners.

Planner Description C# JS/TS Python
ActionPlanner Powerful planner that uses LLMs to generate plans. It has a built-in prompt management, LLM modularity, amongst other features.
AssistantsPlanner A planner that uses OpenAI's Assistants APIs to generate plans.

Plan

A plan is the entity that is generated by the planner. It is a JSON object of the following shape:

{
  "type": "plan",
  "commands": [
    {
      "type": "DO",
      "action": "<name>",
      "parameters": {
        "<name>": "<value>"
      }
    },
    {
      "type": "SAY",
      "response": "<response>"
    }
  ]
}

A plan consists of two types of commands and their entities:

  • SAY: Sends a message to the user.
    • response: The string message to send.
  • DO: AI system will execute a specific action, passing in the generated parameters.
    • action: A lambda function registered to the AI system
    • parameters: A dictionary passed to the action.

The JSON object string is returned by the LLM and deserialized into an object.

Example

Here's an example of a plan for the following ask:

User: Create a grocery shopping list and add bananas to it.

Plan:

{
  "type": "plan",
  "commands": [
    {
      "type": "DO",
      "action": "createList",
      "entities": {
        "name": "Grocery Shopping"
      }
    },
    {
      "type": "DO",
      "action": "addItem",
      "entities": {
        "name": "Bananas"
      }
    },
    {
      "type": "SAY",
      "response": "Created a grocery shopping list and added a banana to it."
    }
  ]
}

This plan is executed in sequential order. So first the list will be created and then an item will be added to it. Finally, the response message will be sent to the user.


Return to other major section topics: