Skip to content

Commit 210cd81

Browse files
Merge pull request Azure-Samples#98 from yalaudah/update-notebook-openai-sdk
Update function calling sample notebooks to the new OpenAI v1 SDK
2 parents 635b2be + 33b3401 commit 210cd81

File tree

6 files changed

+439
-504
lines changed

6 files changed

+439
-504
lines changed

Basic_Samples/Functions/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ pip install -r requirements.txt
99
```
1010

1111
### Microsoft Azure Endpoints
12-
In order to use the Open AI library or REST API with Microsoft Azure endpoints, you need to set DEPLOYMENT_ID, OPENAI_API_BASE & OPENAI_API_VERSION in the _config.json_ file.
12+
In order to use the OpenAI library or REST API with Microsoft Azure endpoints, you need to set your `AZURE_OPENAI_ENDPOINT` in the `config.json` file. We've prepopulated the `MODEL_NAME` and `OPENAI_API_VERSION` variables for you in the `config.json` file with default values. You can change these values if you like.
1313

1414
```json
1515
{
1616
"DEPLOYMENT_ID":"<Model Deployment Name>",
17-
"OPENAI_API_BASE":"https://<Your Azure Resource Name>.openai.azure.com",
17+
"AZURE_OPENAI_ENDPOINT":"https://<Your Azure Resource Name>.openai.azure.com",
1818
"OPENAI_API_VERSION":"<OpenAI API Version>",
1919

2020
// Only required for the functions_with_azure_search.ipynb notebook
@@ -25,7 +25,7 @@ In order to use the Open AI library or REST API with Microsoft Azure endpoints,
2525
```
2626

2727
### For getting started:
28-
- Add "OPENAI_API_KEY" as variable name and \<Your API Key Value\> as variable value in the environment variables.
28+
- Add `OPENAI_API_KEY` as variable name and \<Your API Key Value\> as variable value in the environment variables.
2929
<br>
3030
One can get the OPENAI_API_KEY value from the Azure Portal. Go to https://portal.azure.com, find your resource and then under "Resource Management" -> "Keys and Endpoints" look for one of the "Keys" values.
3131
<br>
@@ -36,11 +36,8 @@ One can get the OPENAI_API_KEY value from the Azure Portal. Go to https://portal
3636
MACOS/LINUX Users:
3737
export OPENAI_API_KEY="REPLACE_WITH_YOUR_KEY_VALUE_HERE"
3838

39-
- To find your "DEPLOYMENT_ID" go to the deployments page of the Azure AI Studio. Create a deployment if one does not already exist.
40-
One can start with using your model name as "gpt-35-turbo-0613" or "gpt-4."
39+
- To find your `AZURE_OPENAI_ENDPOINT` go to https://portal.azure.com, find your resource and then under "Resource Management" -> "Keys and Endpoints" look for the "Endpoint" value.
4140

42-
- To find your "OPENAI_API_BASE" go to https://portal.azure.com, find your resource and then under "Resource Management" -> "Keys and Endpoints" look for the "Endpoint" value.
43-
- Current, function calling can only be used with the "2023-07-01-preview" API version. Check out versions [here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference).
4441

4542

4643
## Requirements
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"DEPLOYMENT_NAME":"<Model Deployment Name>",
3-
"OPENAI_API_BASE":"https://<Your Azure Resource Name>.openai.azure.com",
4-
"OPENAI_API_VERSION":"<OpenAI API Version>",
2+
"MODEL_NAME":"gpt-35-turbo",
3+
"AZURE_OPENAI_ENDPOINT":"https://<Your Azure Resource Name>.openai.azure.com",
4+
"OPENAI_API_VERSION":"2023-12-01-preview",
55

66
"SEARCH_SERVICE_ENDPOINT": "https://<Your Search Service Name>.search.windows.net",
77
"SEARCH_INDEX_NAME": "recipes-vectors",
88
"SEARCH_ADMIN_KEY": "",
99

1010
"BING_SEARCH_SUBSCRIPTION_KEY": ""
1111

12-
}
12+
}

0 commit comments

Comments
 (0)