You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/includes/javascript.md
+47-9Lines changed: 47 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ In a console window (such as cmd, PowerShell, or Bash), create a new directory f
37
37
Install the required packages for JavaScript with npm from within the context of your new directory:
38
38
39
39
```console
40
-
npm install openai @azure/openai dotenv
40
+
npm install openai dotenv @azure/identity
41
41
```
42
42
43
43
Your app's _package.json_ file will be updated with the dependencies.
@@ -50,24 +50,26 @@ Your app's _package.json_ file will be updated with the dependencies.
50
50
Open a command prompt where you created the new project, and create a new file named Completion.js. Copy the following code into the Completion.js file.
constdeployment="gpt-35-turbo-instruct"; //The deployment name for your completions API model. The instruct model is the only new model that supports the legacy API.
constdeploymentId="gpt-35-turbo-instruct"; //The deployment name for your completions API model. The instruct model is the only new model that supports the legacy API.
> For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../key-vault/general/overview.md). For more information about credential security, see the Azure AI services [security](../../security-features.md) article.
86
-
87
86
Run the script with the following command:
88
87
89
88
```cmd
@@ -98,6 +97,45 @@ node.exe Completion.js
98
97
Microsoft was founded on April 4, 1975.
99
98
```
100
99
100
+
## Microsoft Entra ID
101
+
102
+
> [!IMPORTANT]
103
+
> In the previous example we are demonstrating key-based authentication. Once you have tested with key based authentication successfully, we recommend using the more secure [Microsoft Entra ID](/entra/fundamentals/whatis) for authentication which is demonstrated in the next code sample.
> [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)
0 commit comments