Skip to content

Commit 109c260

Browse files
committed
edit
1 parent fa77fd9 commit 109c260

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

articles/ai-services/openai/includes/assistants-javascript.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ ms.date: 04/08/2024
1919

2020
Currently, access to this service is granted only by application. You can apply for access to Azure OpenAI by completing the form at <a href="https://aka.ms/oai/access" target="_blank">https://aka.ms/oai/access</a>. Open an issue on this repo to contact us if you have an issue.
2121
- <a href="https://nodejs.org/" target="_blank">Node.js LTS with TypeScript or ESM support.</a>
22-
- npm package `@azure/identity` for passwordless authentication or `@azure/core-auth` for service key authentication
23-
- npm package `@azure/openai-assistants`
22+
- npm package `@azure/identity` for passwordless authentication or `@azure/core-auth` for service key authentication.
23+
- [Azure CLI](/cli/azure/install-azure-cli) used for passwordless authentication in a local development environment, create the necessary context by signing in with the Azure CLI.
24+
- npm package `@azure/openai-assistants`.
2425
- Azure OpenAI Assistants are currently available in Sweden Central, East US 2, and Australia East. For more information about model availability in those regions, see the [models guide](../concepts/models.md).
2526
- We recommend reviewing the [Responsible AI transparency note](/legal/cognitive-services/openai/transparency-note?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext&tabs=text) and other [Responsible AI resources](/legal/cognitive-services/openai/overview?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext) to familiarize yourself with the capabilities and limitations of the Azure OpenAI Service.
2627
- An Azure OpenAI resource with the `gpt-4 (1106-preview)` model deployed was used testing this example.
@@ -61,6 +62,30 @@ Create and assign persistent environment variables for your key and endpoint.
6162

6263
[!INCLUDE [environment-variables](environment-variables.md)]
6364

65+
Add an additional environment variable for the deployment name: `AZURE_OPENAI_DEPLOYMENT_NAME`.
66+
67+
Create and assign persistent environment variables for your key and endpoint.
68+
69+
# [Command Line](#tab/command-line)
70+
71+
```cmd
72+
setx AZURE_OPENAI_DEPLOYMENT_NAME "REPLACE_WITH_YOUR_DEPLOYMENT_NAME"
73+
```
74+
75+
# [PowerShell](#tab/powershell)
76+
77+
```powershell
78+
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_DEPLOYMENT_NAME', 'REPLACE_WITH_YOUR_DEPLOYMENT_NAME', 'User')
79+
```
80+
81+
# [Bash](#tab/bash)
82+
83+
```bash
84+
export AZURE_OPENAI_DEPLOYMENT_NAME="REPLACE_WITH_YOUR_DEPLOYMENT_NAME"
85+
```
86+
87+
---
88+
6489
## Create an assistant
6590

6691
In our code we are going to specify the following values:
@@ -76,27 +101,24 @@ In our code we are going to specify the following values:
76101

77102
An individual assistant can access up to 128 tools including `code interpreter`, as well as any custom tools you create via [functions](../how-to/assistant-functions.md).
78103

79-
#### [Recommended: TS Passwordless](#tab/typescript-passwordless)
104+
#### [TypeScript](#tab/typescript)
80105

81-
Create and run an assistant with the following TypeScript module:
106+
Sign in to Azure with `az login` then create and run an assistant with the following **recommdended** passwordless TypeScript module (index.ts):
82107

83108
:::code language="typescript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/ts/src/index.ts" :::
84109

85-
#### [JS Passwordless](#tab/javascript-passwordless)
86-
87-
Create and run an assistant with the following TypeScript module:
110+
To use the service key for authentication, you can create and run an assistant with the following TypeScript module (index.ts):
88111

89-
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index.mjs" :::
112+
:::code language="typescript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/ts/src/index-using-password.ts" :::
90113

91-
#### [TS Password](#tab/typescript-password)
114+
#### [JavaScript](#tab/javascript)
92115

93-
Create and run an assistant with the following TypeScript module:
94116

95-
:::code language="typescript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/ts/src/index-using-password.ts" :::
117+
Sign in to Azure with `az login` then create and run an assistant with the following **recommdended** passwordless Javascript module (index.mjs):
96118

97-
#### [JS Password](#tab/javascript-password)
119+
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index.mjs" :::
98120

99-
Create and run an assistant with the following TypeScript module:
121+
To use the service key for authentication, you can create and run an assistant with the following JavaScript module (index.mjs):
100122

101123
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index-using-password.mjs" :::
102124

0 commit comments

Comments
 (0)