sp-dev-fx-webparts/samples/react-azure-openai-connector
dependabot[bot] 6579c1c010
Bump webpack-dev-middleware in /samples/react-azure-openai-connector
Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-middleware/compare/v5.3.3...v5.3.4)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 19:22:04 +00:00
..
.devcontainer Added devcontainer, sample.json, fixed readme 2023-08-09 23:28:43 -04:00
assets Updated video, sample.json, version number 2023-10-23 11:35:52 -04:00
config docs added 2023-07-26 11:45:41 +02:00
src Minor UX improvements + Link to community call recording 2023-10-06 11:42:00 +02:00
teams webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
.eslintrc.js webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
.gitignore webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
.npmignore webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
.nvmrc Updated video, sample.json, version number 2023-10-23 11:35:52 -04:00
.yo-rc.json webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
README.md Updated video, sample.json, version number 2023-10-23 11:35:52 -04:00
gulpfile.js webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00
package-lock.json Bump webpack-dev-middleware in /samples/react-azure-openai-connector 2024-03-23 19:22:04 +00:00
package.json Bump jszip and @microsoft/sp-build-web 2023-09-19 14:12:42 +00:00
tsconfig.json webpart scaffolded and initial UI version 2023-07-24 22:20:44 +02:00

README.md

Using Azure OpenAI Connectors API

Summary

This (experimental) web part, shows how to use the new feature (in preview at the moment of building this sample) Azure OpenAI Data Connectors.

./assets/react-azure-openai-connector.gif

The web part is calling the Azure OpenAI API, with a specific Data source configured to an existing Azure Search service that contains the Hotels index provided by Microsoft. The following screenshots shows how you can configure the connector through the new Azure OpenAI Studio. This is NOT required for the sample, but helps to understand what the web part is doing behind the scenes.

First, you have configured your Search service (any tier except the free one) importing the Hotels data sample provided by Microsoft

./assets/studio01.png

./assets/studio02.png

Now, from the Azure OpenAI Studio, in the Chat playground, you can configure your data connector:

./assets/studio03.png

Connect it to your Azure Search Hotels index:

./assets/studio04.png ./assets/studio05.png

Follow the assistant to create the Connector. Once is done, you can use chatGPT to find hotels using natural language:

./assets/studio06.png

The web part offers the same functionality, showing how to call the Azure OpenAI API, with a pre-configured Data source.

Note: this is an experimental sample, based on the preview of the Azure OpenAI service, and the preview of the Data Connectors. Ensure you check the prerequisites section if you are planning to run this sample.

Used SharePoint Framework Version

version

Applies to

Prerequisites

  • Your Azure Subscription has the Azure OpenAI service available. You will see this message if you try to add Azure OpenAI service in your Subscription (follow the link in the Azure portal to request access).

Azure OpenAI Service is currently available to customers via an application form. The selected subscription has not been enabled for use of the service and does not have quota for any pricing tiers. Click here to request access to Azure OpenAI service.

  • You have created an Azure OpenAI service in your subscription (create it in a US region, as some features may not be available in other regions)
  • Grab the Azure OpenAI Key (go to your Azure OpenAI service -> Keys and Endpoint)
  • You have configured an Azure Search service with at least a Basic plan (Free tier is not working with the Azure OpenAI Connectors feature), and have deployed the "Hotels" index that is provided as sample by Microsoft.
  • Grab the Azure Search endpoint URL (you can see it in the Overview section)
  • Grab the Azure Search API key (Keys section)

Contributors

Version history

Version Date Comments
1.0 July 26, 2023 Initial release
1.1 October 6, 2023 Ctrl + enter to submit the query. Auto-scroll in the Messages list.

Minimal Path to Awesome

  • Install the MS Graph Toolkit for SPFx package. Follow this
  • Clone this repository
  • Ensure that you are at the solution folder
  • Edit the file Constants.ts with your values (see prerequisites section)
  • in the command-line run:
    • npm install
    • gulp serve
  • Add the web part in the SharePoint workbench or any SharePoint page (appending ?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js to the page URL)

Features

This extension illustrates the following concepts:

  • Calling Azure OpenAI completions endpoint with a configured Azure Search connector
  • Using MS Graph toolkit with the Person component
  • Multiple FluentUI components

References

Video

Using Azure Open AI custom data sources with SPFx

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you're having issues building the solution, please run spfx doctor from within the solution folder to diagnose incompatibility issues with your environment.

You can try looking at issues related to this sample to see if anybody else is having the same issues.

You can also try looking at discussions related to this sample and see what the community is saying.

If you encounter any issues using this sample, create a new issue.

For questions regarding this sample, create a new question.

Finally, if you have an idea for improvement, make a suggestion.

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.