Part 1: Create Function

GPT
System Prompt
Intermediate

Prompt

**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.

    1. `TENANT_ID`: copied from previous section

    2. `CLIENT_ID`: copied from previous section

    3. _Solution 2 only:_

       1. `OPENAI_API_KEY:` spin up an OpenAI API key on platform.openai.com.

16. Go to the **Console** tab under the **Development Tools**

    1. Install the following packages in console

       1. `npm install @microsoft/microsoft-graph-client`

       2. `npm install axios`

       3. _Solution 2 only:_

          1. `npm install pdf-parse`

          2. `npm install openai`

17. Once this is complete, try calling the function (POST call) from Postman again, putting the below into body (using a query and search term you think will generate responses).

     *Solution 1*:
     ```json
    {
        "searchTerm": "<choose a search term>"
    }
    ```
    *Solution 2*: 
    ```json
    {
        "query": "<choose a question>",
        "searchTerm": "<choose a search term>"
    }
    ```
18. If you get a response, you are ready to set this up with a Custom GPT!