Fixing bug with Azure functions ChatGPT post - moving images (#1237)
Co-authored-by: Max Reid <max.reid11@gmail.com>
This commit is contained in:
parent
5518d04b65
commit
c342687ac2
8 changed files with 19 additions and 11 deletions
|
|
@ -18,7 +18,8 @@ The second solution **Solution 2** pre-processes the file within the Azure Funct
|
|||
|
||||
### Solution 1: Returning the file to GPT using the [Returning Files](https://platform.openai.com/docs/actions/getting-started/returning-files) pattern
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
This solution uses a Node.js Azure Function to, based on the logged in user:
|
||||
|
||||
|
|
@ -30,13 +31,17 @@ This solution uses a Node.js Azure Function to, based on the logged in user:
|
|||
|
||||
4. Return that to ChatGPT. The GPT then can use those files as if you had uploaded it to the conversation.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
### Solution 2: Converting the file to text in the Azure Function
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
This solution uses a Node.js Azure Function to, based on the logged in user:
|
||||
|
|
@ -51,7 +56,8 @@ This solution uses a Node.js Azure Function to, based on the logged in user:
|
|||
|
||||
As you can see from the below architecture diagram, the first three steps are the same as Solution 1. The main difference is that this solution converts the file to text instead of a base64 string, and then summarizes that text using GPT 3.5 Turbo.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
|
@ -84,7 +90,7 @@ As you can see from the below architecture diagram, the first three steps are th
|
|||
## Solution 1 + Solution 2 Installation Instructions
|
||||
|
||||
The below are the instructions for setting up the Azure Function with Authentication. Please make sure to follow these steps before implementing the code.
|
||||
> [!NOTE]
|
||||
|
||||
> These installation instructions apply to both Solution 1 and Solution 2. We encourage setting both solutions up as separate functions within the same Function App to test which works best for you, as once you set up one function, it takes only a few minutes to set up another function in that same function app.
|
||||
|
||||
|
||||
|
|
@ -107,7 +113,9 @@ See the documentation [here](https://learn.microsoft.com/en-us/azure/azure-funct
|
|||
|
||||
##### Part 1: Create Function
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
1. Create an [Azure Function app](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview?pivots=programming-language-csharp). I used the following settings but you can use anything you are comfortable with. Note that not every language / operating system allows for editing the functions in the console directly - the combination I chose below does. For my walkthrough, I left everything as default and made the selections below
|
||||
|
||||
|
|
@ -125,7 +133,6 @@ See the documentation [here](https://learn.microsoft.com/en-us/azure/azure-funct
|
|||
|
||||
2. After completing the above, you’ll land on the “Deployments” page. Once the deployment completes (which should only take a few minutes) click on **“Go to Resource”** to go back to the Function App
|
||||
|
||||
> [!NOTE]
|
||||
> You may get an error the first time you attempt this, click create again and it will likely work.
|
||||
|
||||
|
||||
|
|
@ -176,7 +183,9 @@ See the documentation [here](https://learn.microsoft.com/en-us/azure/azure-funct
|
|||
|
||||
10. Click on the function you just created (You may need to click refresh to see it). Click on **Get Function URL** and save it to test in Postman. You will also use this when creating the OpenAPI spec later when you put it into the GPT.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
11. Go back to the function app and click on **Configuration.** Show the value for the `MICROSOFT_PROVIDER_AUTHENTICATION_SECRET` variable, copy it (click advanced edit to copy it), and **save it for later.**
|
||||
|
||||
|
|
@ -209,7 +218,7 @@ At this point, you should have a test function created, and you should have save
|
|||
Now that you have an authenticated Azure Function, we can update the function to search SharePoint / O365
|
||||
|
||||
14. Go to your test function and paste in the code from [this file](./solution_one_file_retrieval.js) for Solution 1 and [this file](./solution_two_preprocessing.js) for Solution 2. Save the function.
|
||||
> [!NOTE]
|
||||
|
||||
> **This code is meant to be directional** - while it should work out of the box, it is designed to be customized to your needs (see examples towards the end of this document).
|
||||
|
||||
15. Set up the following env variables by going to the **Configuration** tab on the left under **Settings.** Note that this may be listed directly in **Environment Variables** depending on your Azure UI.
|
||||
|
|
|
|||
BIN
images/create_function_app.png
Normal file
BIN
images/create_function_app.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 342 KiB |
BIN
images/get_function_url.png
Normal file
BIN
images/get_function_url.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
BIN
images/solution_1.gif
Normal file
BIN
images/solution_1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 MiB |
BIN
images/solution_1_architecture.png
Normal file
BIN
images/solution_1_architecture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 195 KiB |
BIN
images/solution_2.gif
Normal file
BIN
images/solution_2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
BIN
images/solution_2_architecture.png
Normal file
BIN
images/solution_2_architecture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 194 KiB |
|
|
@ -1313,5 +1313,4 @@
|
|||
- maxreid-openai
|
||||
tags:
|
||||
- completions
|
||||
- chatgpt
|
||||
- whisper
|
||||
- chatgpt
|
||||
Loading…
Reference in a new issue