Skip to content

Commit 71cfd8e

Browse files
Merge pull request #268412 from aahill/mar-qs-update
updating variables, REST API
2 parents dc12960 + a5abde4 commit 71cfd8e

File tree

6 files changed

+44
-33
lines changed

6 files changed

+44
-33
lines changed

articles/ai-services/openai/includes/use-your-data-common-variables.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To successfully make a call against Azure OpenAI, you need the following variabl
1616
|--------------------------|-------------|
1717
| `AZURE_OPENAI_ENDPOINT` | This value can be found in the **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. Alternatively, you can find the value in **Azure AI studio** > **Chat playground** > **Code view**. An example endpoint is: `https://my-resoruce.openai.azure.com`.|
1818
| `AZURE_OPENAI_API_KEY` | This value can be found in **Resource management** > **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. |
19-
| `AZURE_OPEN_AI_DEPLOYMENT_ID` | This value corresponds to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure AI studio.|
19+
| `AZURE_OPENAI_DEPLOYMENT_ID` | This value corresponds to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure AI studio.|
2020
| `AZURE_AI_SEARCH_ENDPOINT` | This value can be found in the **Overview** section when examining your Azure AI Search resource from the Azure portal. |
2121
| `AZURE_AI_SEARCH_API_KEY` | This value can be found in the **Settings** > **Keys** section when examining your Azure AI Search resource from the Azure portal. You can use either the primary admin key or secondary admin key. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. |
2222
| `AZURE_AI_SEARCH_INDEX` | This value corresponds to the name of the index you created to store your data. You can find it in the **Overview** section when examining your Azure AI Search resource from the Azure portal. |
@@ -56,7 +56,7 @@ setx AZURE_AI_SEARCH_INDEX REPLACE_WITH_YOUR_INDEX_NAME_HERE
5656
```
5757

5858
```powershell
59-
[System.Environment]::SetEnvironmentVariable('AZURE_OPEN_AI_DEPLOYMENT_ID', 'REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE', 'User')
59+
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_DEPLOYMENT_ID', 'REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE', 'User')
6060
```
6161

6262
```powershell
@@ -80,7 +80,7 @@ export AZURE_OPENAI_ENDPOINT=REPLACE_WITH_YOUR_AOAI_ENDPOINT_VALUE_HERE
8080
export AZURE_OPENAI_API_KEY=REPLACE_WITH_YOUR_AOAI_KEY_VALUE_HERE
8181
```
8282
```Bash
83-
export AZURE_OPEN_AI_DEPLOYMENT_ID=REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE
83+
export AZURE_OPENAI_DEPLOYMENT_ID=REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE
8484
```
8585
```Bash
8686
export AZURE_AI_SEARCH_ENDPOINT=REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_VALUE_HERE

articles/ai-services/openai/includes/use-your-data-dotnet.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: travisw
55
ms.author: travisw
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 08/29/2023
8+
ms.date: 03/07/2024
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -24,10 +24,10 @@ using static System.Environment;
2424

2525
string azureOpenAIEndpoint = GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
2626
string azureOpenAIKey = GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
27+
string deploymentName = GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_ID");
2728
string searchEndpoint = GetEnvironmentVariable("AZURE_AI_SEARCH_ENDPOINT");
2829
string searchKey = GetEnvironmentVariable("AZURE_AI_SEARCH_API_KEY");
2930
string searchIndex = GetEnvironmentVariable("AZURE_AI_SEARCH_INDEX");
30-
string deploymentName = GetEnvironmentVariable("AZURE_OPEN_AI_DEPLOYMENT_ID");
3131

3232

3333
var client = new OpenAIClient(new Uri(azureOpenAIEndpoint), new AzureKeyCredential(azureOpenAIKey));
@@ -130,10 +130,10 @@ using static System.Environment;
130130

131131
string azureOpenAIEndpoint = GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
132132
string azureOpenAIKey = GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
133+
string deploymentName = GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_ID");
133134
string searchEndpoint = GetEnvironmentVariable("AZURE_AI_SEARCH_ENDPOINT");
134135
string searchKey = GetEnvironmentVariable("AZURE_AI_SEARCH_API_KEY");
135136
string searchIndex = GetEnvironmentVariable("AZURE_AI_SEARCH_INDEX");
136-
string deploymentName = GetEnvironmentVariable("AZURE_OPEN_AI_DEPLOYMENT_ID");
137137

138138

139139
var client = new OpenAIClient(new Uri(azureOpenAIEndpoint), new AzureKeyCredential(azureOpenAIKey));

articles/ai-services/openai/includes/use-your-data-go.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: travisw
55
ms.author: travisw
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 08/29/2023
8+
ms.date: 03/07/2024
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -48,7 +48,7 @@ ms.date: 08/29/2023
4848
4949
func main() {
5050
azureOpenAIKey := os.Getenv("AZURE_OPENAI_API_KEY")
51-
modelDeploymentID := os.Getenv("AZURE_OPEN_AI_DEPLOYMENT_ID")
51+
modelDeploymentID := os.Getenv("AZURE_OPENAI_DEPLOYMENT_ID")
5252
5353
// Ex: "https://<your-azure-openai-host>.openai.azure.com"
5454
azureOpenAIEndpoint := os.Getenv("AZURE_OPENAI_ENDPOINT")

articles/ai-services/openai/includes/use-your-data-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const { OpenAIClient, AzureKeyCredential } = require("@azure/openai");
4141
// Set the Azure and AI Search values from environment variables
4242
const endpoint = process.env["AZURE_OPENAI_ENDPOINT"];
4343
const azureApiKey = process.env["AZURE_OPENAI_API_KEY"];
44+
const deploymentId = process.env["AZURE_OPENAI_DEPLOYMENT_ID"];
4445
const searchEndpoint = process.env["AZURE_AI_SEARCH_ENDPOINT"];
4546
const searchKey = process.env["AZURE_AI_SEARCH_API_KEY"];
4647
const searchIndex = process.env["AZURE_AI_SEARCH_INDEX"];
47-
const deploymentId = process.env["AZURE_OPEN_AI_DEPLOYMENT_ID"];
4848

4949

5050
async function main(){

articles/ai-services/openai/includes/use-your-data-python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: mrbullwinkle #travisw
55
ms.author: mbullwin #travisw
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 11/09/2023
8+
ms.date: 03/07/2024
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -82,12 +82,12 @@ pip install python-dotenv
8282

8383
openai.requestssession = session
8484

85-
aoai_deployment_id = os.environ.get("AZURE_OPEN_AI_DEPLOYMENT_ID")
85+
aoai_deployment_id = os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID")
8686
setup_byod(aoai_deployment_id)
8787

8888
completion = openai.ChatCompletion.create(
8989
messages=[{"role": "user", "content": "What are the differences between Azure Machine Learning and Azure AI services?"}],
90-
deployment_id=os.environ.get("AZURE_OPEN_AI_DEPLOYMENT_ID"),
90+
deployment_id=os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID"),
9191
dataSources=[ # camelCase is intentional, as this is the format the API expects
9292
{
9393
"type": "AzureCognitiveSearch",
@@ -113,7 +113,7 @@ dotenv.load_dotenv()
113113

114114
endpoint = os.environ.get("AZURE_OPENAI_ENDPOINT")
115115
api_key = os.environ.get("AZURE_OPENAI_API_KEY")
116-
deployment = os.environ.get("AZURE_OPEN_AI_DEPLOYMENT_ID")
116+
deployment = os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID")
117117

118118
client = openai.AzureOpenAI(
119119
base_url=f"{endpoint}/openai/deployments/{deployment}/extensions",

articles/ai-services/openai/includes/use-your-data-rest.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: aahill
55
ms.author: aahi
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 08/11/2023
8+
ms.date: 03/07/2024
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -20,26 +20,26 @@ To trigger a response from the model, you should end with a user message indicat
2020
> There are several parameters you can use to change the model's response, such as `temperature` or `top_p`. See the [reference documentation](../reference.md#completions-extensions) for more information.
2121
2222
```bash
23-
curl -i -X POST $AZURE_OPENAI_ENDPOINT/openai/deployments/$AZURE_OPEN_AI_DEPLOYMENT_ID/extensions/chat/completions?api-version=2023-06-01-preview \
23+
curl -i -X POST $AZURE_OPENAI_ENDPOINT/openai/deployments/$AZURE_OPENAI_DEPLOYMENT_ID/chat/completions?api-version=2024-02-15-preview \
2424
-H "Content-Type: application/json" \
2525
-H "api-key: $AZURE_OPENAI_API_KEY" \
2626
-d \
2727
'
2828
{
29-
"dataSources": [
29+
"data_sources": [
3030
{
3131
"type": "AzureCognitiveSearch",
3232
"parameters": {
3333
"endpoint": "'$AZURE_AI_SEARCH_ENDPOINT'",
3434
"key": "'$AZURE_AI_SEARCH_API_KEY'",
35-
"indexName": "'$AZURE_AI_SEARCH_INDEX'"
35+
"index_name": "'$AZURE_AI_SEARCH_INDEX'"
3636
}
3737
}
3838
],
3939
"messages": [
4040
{
4141
"role": "user",
42-
"content": "What are the differences between Azure Machine Learning and Azure AI services?"
42+
"content": "Tell me an interesting fact"
4343
}
4444
]
4545
}
@@ -51,26 +51,37 @@ curl -i -X POST $AZURE_OPENAI_ENDPOINT/openai/deployments/$AZURE_OPEN_AI_DEPLOYM
5151
```json
5252
{
5353
"id": "12345678-1a2b-3c4e5f-a123-12345678abcd",
54-
"model": "",
55-
"created": 1684304924,
56-
"object": "chat.completion",
54+
"model": "gpt-4",
55+
"created": 1709835345,
56+
"object": "extensions.chat.completion",
5757
"choices": [
5858
{
5959
"index": 0,
60-
"messages": [
61-
{
62-
"role": "tool",
63-
"content": "{\"citations\": [{\"content\": \"\\nAzure AI services are cloud-based artificial intelligence (AI) services...\", \"id\": null, \"title\": \"What is Azure AI services\", \"filepath\": null, \"url\": null, \"metadata\": {\"chunking\": \"orignal document size=250. Scores=0.4314117431640625 and 1.72564697265625.Org Highlight count=4.\"}, \"chunk_id\": \"0\"}], \"intent\": \"[\\\"Learn about Azure AI services.\\\"]\"}",
64-
"end_turn": false
65-
},
66-
{
67-
"role": "assistant",
68-
"content": " \nAzure AI services are cloud-based artificial intelligence (AI) services that help developers build cognitive intelligence into applications without having direct AI or data science skills or knowledge. [doc1]. Azure Machine Learning is a cloud service for accelerating and managing the machine learning project lifecycle. [doc1].",
69-
"end_turn": true
60+
"finish_reason": "stop",
61+
"message": {
62+
"role": "assistant",
63+
"content": "An interesting fact from the retrieved document is... [doc1].",
64+
"end_turn": true,
65+
"context": {
66+
"citations": [
67+
{
68+
"content": "...",
69+
"title": "...",
70+
"url": "https://mysearch.blob.core.windows.net/xyz/001.txt",
71+
"filepath": "001.txt",
72+
"chunk_id": "0"
73+
}
74+
],
75+
"intent": "[\"Interesting facts\"]"
7076
}
71-
]
77+
}
7278
}
73-
]
79+
],
80+
"usage": {
81+
"prompt_tokens": 3779,
82+
"completion_tokens": 105,
83+
"total_tokens": 3884
84+
}
7485
}
7586
```
7687

0 commit comments

Comments
 (0)