Skip to content

Commit 6bcd366

Browse files
committed
update
1 parent 444ca5a commit 6bcd366

File tree

1 file changed

+6
-59
lines changed
  • articles/ai-services/openai/includes

1 file changed

+6
-59
lines changed

articles/ai-services/openai/includes/go.md

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,29 @@ ms.subservice: openai
99
ms.topic: include
1010
author: mrbullwinkle
1111
ms.author: mbullwin
12-
ms.date: 08/23/2023
12+
ms.date: 08/30/2023
1313
keywords:
1414
---
1515

16-
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/ai/azopenai) | [Package (Go)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai)
16+
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/ai/azopenai) | [Package (Go)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai)| [Samples](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai#pkg-examples)
1717

1818
## Prerequisites
1919

2020
- An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services?azure-portal=true)
2121
- Access granted to the Azure OpenAI service in the desired Azure subscription.
2222
Currently, access to this service is granted only by application. You can apply for access to Azure OpenAI Service by completing the form at [https://aka.ms/oai/access](https://aka.ms/oai/access?azure-portal=true).
23-
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
23+
- [Go 1.21.0](https://go.dev/dl/) or higher installed locally.
2424
- An Azure OpenAI Service resource with the text-davinci-003 model deployed. For more information about model deployment, see the [resource deployment guide](../how-to/create-resource.md).
2525

26-
> [!div class="nextstepaction"]
27-
> [I ran into an issue with the prerequisites.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=JAVASCRIPT&Pillar=AOAI&&Product=gpt&Page=quickstart&Section=Prerequisites)
28-
2926
## Set up
3027

31-
### Retrieve key and endpoint
32-
33-
To successfully make a call against Azure OpenAI, you need an **endpoint** and a **key**.
34-
35-
|Variable name | Value |
36-
|--------------------------|-------------|
37-
| `ENDPOINT` | This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. Alternatively, you can find the value in the **Azure OpenAI Studio** > **Playground** > **Code View**. An example endpoint is: `https://docs-test-001.openai.azure.com/`.|
38-
| `API-KEY` | This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. You can use either `KEY1` or `KEY2`.|
39-
40-
Go to your resource in the Azure portal. The **Endpoint and Keys** can be found in the **Resource Management** section. Copy your endpoint and access key as you'll need both for authenticating your API calls. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.
41-
42-
:::image type="content" source="../media/quickstarts/endpoint.png" alt-text="Screenshot of the overview UI for an OpenAI Resource in the Azure portal with the endpoint and access keys location circled in red." lightbox="../media/quickstarts/endpoint.png":::
43-
44-
Create and assign persistent environment variables for your key and endpoint.
45-
46-
### Environment variables
47-
48-
# [Command Line](#tab/command-line)
49-
50-
```CMD
51-
setx AZURE_OPENAI_KEY "REPLACE_WITH_YOUR_KEY_VALUE_HERE"
52-
```
53-
54-
```CMD
55-
setx AZURE_OPENAI_ENDPOINT "REPLACE_WITH_YOUR_ENDPOINT_HERE"
56-
```
57-
58-
# [PowerShell](#tab/powershell)
59-
60-
```powershell
61-
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_KEY', 'REPLACE_WITH_YOUR_KEY_VALUE_HERE', 'User')
62-
```
63-
64-
```powershell
65-
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_ENDPOINT', 'REPLACE_WITH_YOUR_ENDPOINT_HERE', 'User')
66-
```
67-
68-
# [Bash](#tab/bash)
28+
[!INCLUDE [get-key-endpoint](get-key-endpoint.md)]
6929

70-
```Bash
71-
echo export AZURE_OPENAI_KEY="REPLACE_WITH_YOUR_KEY_VALUE_HERE" >> /etc/environment && source /etc/environment
72-
```
73-
74-
```Bash
75-
echo export AZURE_OPENAI_ENDPOINT="REPLACE_WITH_YOUR_ENDPOINT_HERE" >> /etc/environment && source /etc/environment
76-
```
77-
---
78-
79-
> [!div class="nextstepaction"]
80-
> [I ran into an issue with the setup.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=JAVASCRIPT&Pillar=AOAI&&Product=gpt&Page=quickstart&Section=Set-up-the-environment)
30+
[!INCLUDE [environment-variables](environment-variables.md)]
8131

8232
## Create a sample application
8333

84-
Create a new file named completion.go. Copy the following code into the completion.go file.
34+
Create a new file named completions.go. Copy the following code into the completions.go file.
8535

8636
```go
8737
package main
@@ -163,9 +113,6 @@ go run completions.go
163113
Microsoft was founded on April 4, 1975.
164114
```
165115

166-
> [!div class="nextstepaction"]
167-
> [I ran into an issue when running the code sample.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=JAVASCRIPT&Pillar=AOAI&&Product=gpt&Page=quickstart&Section=Create-application)
168-
169116
## Clean up resources
170117

171118
If you want to clean up and remove an Azure OpenAI resource, you can delete the resource. Before deleting the resource, you must first delete any deployed models.

0 commit comments

Comments
 (0)