Updated Sample Details

This commit is contained in:
Chris Kent 2024-02-08 14:14:30 -05:00
parent 4ff53d4896
commit 15d48aef70
3 changed files with 21 additions and 12 deletions

View File

@ -1,10 +1,10 @@
# Calling Azure OpenAI API in Stream mode
# Calling Azure OpenAI API in Streaming Mode
## Summary
This web part shows how you can call Azure OpenAI API in Streaming mode, so the web part shows the data coming from the API in chunks, giving a much better user experience, so you are not waiting for the entire response. It also shows how you can cancel the streaming response at any point, which is useful to safe some tokens (hence money), if the generating response does not look good to you (like when getting AI hallucinations).
This web part shows how you can call Azure OpenAI API in Streaming mode. The web part will show the data coming from the API in chunks, giving a much better user experience, so you are not waiting for the entire response. It also shows how you can cancel the streaming response at any point, which is useful to save some tokens (hence money), if the generating response does not look good to you (like when getting AI hallucinations). AI responses render Markdown but there is a toggle to disable so you can compare Markdown rendering of responses with Streaming and without.
![./assets/react-azure-openai-api-stream.gif](./assets/react-azure-openai-api-stream.gif)
![Sample in action](./assets/screenshot.gif)
## Compatibility
@ -52,7 +52,7 @@ This sample is optimally compatible with the following environment configuration
| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | January 2, 2024 | Initial release |
| 1.1 | January 29, 2024 | Things and Stuff |
| 1.1 | February 8, 2024 | Theme enhancements & markdown support |
## Minimal Path to Awesome
@ -75,10 +75,7 @@ This sample illustrates the following concepts:
- How to cancel an streaming request
- Using MS Graph toolkit with the Person component
- Multiple FluentUI components
> Notice that better pictures and documentation will increase the sample usage and the value you are providing for others. Thanks for your submissions advance.
> Share your web part with others through Microsoft 365 Patterns and Practices program to get visibility and exposure. More details on the community, open-source projects and other activities from http://aka.ms/m365pnp.
- Markdown rendering of AI responses
## References
@ -87,3 +84,10 @@ This sample illustrates the following concepts:
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
- [Publish SharePoint Framework applications to the Marketplace](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview)
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development
## 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.**
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-azure-openai-api-stream" />

View File

@ -2,15 +2,15 @@
{
"name": "pnp-sp-dev-spfx-web-parts-react-azure-openai-api-stream",
"source": "pnp",
"title": "Calling Azure OpenAI API in stream mode",
"title": "Calling Azure OpenAI API in streaming mode",
"shortDescription": "This web part shows how you can call Azure OpenAI API in Streaming mode",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-azure-openai-api-stream",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-azure-openai-api-stream",
"longDescription": [
"This web part shows how you can call Azure OpenAI API in Streaming mode, so the web part shows the data coming from the API in chunks, giving a much better user experience, so you are not waiting for the entire response. It also shows how you can cancel the streaming response at any point, which is useful to safe some tokens (hence money), if the generating response does not look good to you (like when getting AI hallucinations)."
"This web part shows how you can call Azure OpenAI API in Streaming mode. The web part will show the data coming from the API in chunks, giving a much better user experience, so you are not waiting for the entire response. It also shows how you can cancel the streaming response at any point, which is useful to save some tokens (hence money), if the generating response does not look good to you (like when getting AI hallucinations). AI responses render Markdown but there is a toggle to disable so you can compare Markdown rendering of responses with Streaming and without."
],
"creationDateTime": "2024-01-02",
"updateDateTime": "2024-01-02",
"updateDateTime": "2024-02-08",
"products": [
"SharePoint"
],
@ -28,7 +28,7 @@
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/blob/main/samples/react-azure-openai-api-stream/assets/react-azure-openai-api-stream.gif",
"url": "https://github.com/pnp/sp-dev-fx-webparts/blob/main/samples/react-azure-openai-api-stream/assets/screenshot.gif",
"alt": "Web Part Preview"
}
],
@ -37,6 +37,11 @@
"gitHubAccount": "luismanez",
"pictureUrl": "https://github.com/luismanez.png",
"name": "Luis Mañez"
},
{
"gitHubAccount": "thechriskent",
"pictureUrl": "https://github.com/thechriskent.png",
"name": "Chris Kent"
}
],
"references": [

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB