Files
semantic-kernel/samples/apps/auth-api-webapp-react
Lee Miller 77259db3e3 Remove PlannerSkill and add SequentialPlanner (#523)
### Motivation and Context
This pull request contains a series of changes that refactor and improve
the planning module and tests in the SemanticKernel project. The
planning module is responsible for creating and executing plans based on
natural language prompts and available skills. The changes aim to
simplify the code, enhance the functionality, and increase the test
coverage and quality of the planning module.

### Description
- Add a new SequentialPlanner class that uses semantic function to
generate plans from natural language prompts
- Add a new SequentialPlanParser class that parses the XML output of the
semantic function and converts it into a Plan object
- **Remove PlannerSkill**
- Rename PlannerConfig class that contains common configuration options
for planner instances, such as the maximum number of tokens, the
relevancy threshold, and the excluded or included functions
- Refactor the Plan class to make it more consistent and robust, and add
support for serialization, named outputs, and nested plans
- Add unit tests for the SequentialPlanner, SequentialPlanParser, and
Plan classes and refactor the existing planning tests to use mock
functions and skills.
- Fix a failing web skill test by skipping it due to inconsistent Bing
search results
2023-04-21 16:01:26 +00:00
..

Authenticated API’s Sample Learning App

Important

This learning sample is for educational purposes only and should not be used in any production use case. It is intended to highlight concepts of Semantic Kernel and not any architectural / security design practices to be used.

Watch the Authenticated API’s Sample Quick Start Video

Running the sample

  1. You will need an Open AI Key or Azure Open AI Service key for this sample
  2. Ensure the KernelHttpServer sample is already running at http://localhost:7071. If not, follow the steps to start it here.
  3. You will also need to register your application in the Azure Portal. Follow the steps to register your app here.
    • Select Single-page application (SPA) as platform type, and the Redirect URI will be http://localhost:3000
    • Select Personal Microsoft accounts only as supported account types for this sample
  4. Copy .env.example into a new file with name ".env".
  5. Once registered, copy the Application (client) ID from the Azure Portal and paste the GUID into the .env file next to REACT_APP_GRAPH_CLIENT_ID= (first line of the .env file).
  6. Run the following command yarn install (if you have never run the sample before) and/or yarn start from the command line.
  7. A browser will automatically open, otherwise you can navigate to http://localhost:3000 to use the sample.

Working with Secrets: KernelHttpServer's Readme has a note on safely working with keys and other secrets.

About the Authenticated API’s Sample

The Authenticated API’s sample allows you to use authentication to connect to the Microsoft Graph using your personal account.

If you don’t have a Microsoft account or do not want to connect to it, you can review the code to see the patterns needed to call out to APIs.

The sample highlights connecting to Microsoft Graph and calling APIs for Outlook, OneDrive, and ToDo. Each function will call Microsoft Graph and/or Open AI to perform the tasks.

Caution

Each function will call Open AI which will use tokens that you will be billed for.

Troubleshooting

unauthorized_client: The client does not exist or is not enabled for consumers.

  1. Ensure in your Application Manifest that Personal Microsoft accounts are allowed to sign in.

    • "signInAudience": "PersonalMicrosoftAccount" or
    • "signInAudience": "AzureADandPersonalMicrosoftAccount"
  2. If you are not able to change the manifest, create a new Application following the instructions in Running the sample, step 3.