Skip to content

Commit 199cf64

Browse files
committed
edit
1 parent 8816b23 commit 199cf64

File tree

1 file changed

+67
-49
lines changed

1 file changed

+67
-49
lines changed

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

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -124,81 +124,99 @@ An individual assistant can access up to 128 tools including `code interpreter`,
124124

125125
#### [TypeScript (Recommended) without key](#tab/typescript)
126126

127-
Create the `index.ts` file with the following **recommended** passwordless TypeScript module (index.ts):
127+
1. Create the `index.ts` file with the following **recommended** passwordless TypeScript module (index.ts):
128128

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

131-
Create the `tsconfig.json` file to transpile the TypeScript code and copy the following code for ECMAScript.
131+
1. Create the `tsconfig.json` file to transpile the TypeScript code and copy the following code for ECMAScript.
132132

133-
```json
134-
{
135-
"compilerOptions": {
136-
"target": "es2022",
137-
"module": "es2022",
138-
"moduleResolution": "node",
139-
}
140-
}
141-
```
133+
```json
134+
{
135+
"compilerOptions": {
136+
"target": "es2022",
137+
"module": "es2022",
138+
"moduleResolution": "node",
139+
}
140+
}
141+
```
142142

143-
#### [TypeScript with key](#tab/typescript)
143+
1. Transpile from TypeScript to JavaScript.
144144

145-
To use the service key for authentication, you can create the `index.ts` file with the following TypeScript module (index.ts):
145+
```shell
146+
tsc index.ts
147+
```
148+
149+
1. Sign in to Azure with the following command:
146150

147-
:::code language="typescript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/ts/src/index-using-password.ts" :::
151+
```shell
152+
az login
153+
```
148154

149-
Create the `tsconfig.json` file to transpile the TypeScript code and copy the following code for ECMAScript.
155+
1. Run the code with the following command:
150156

151-
```json
152-
{
153-
"compilerOptions": {
154-
"target": "es2022",
155-
"module": "es2022",
156-
"moduleResolution": "node",
157-
}
158-
}
159-
```
157+
```shell
158+
node index.js
159+
```
160160

161-
#### [JavaScript without key](#tab/javascript)
161+
#### [TypeScript with key](#tab/typescript-key)
162162

163-
Create the `index.js` file with the following **recommended** passwordless JavaScript module (index.mjs):
163+
1. To use the service key for authentication, you can create the `index.ts` file with the following TypeScript module (index.ts):
164164

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

167-
#### [JavaScript with key](#tab/javascript)
167+
1. Create the `tsconfig.json` file to transpile the TypeScript code and copy the following code for ECMAScript.
168168

169-
To use the service key for authentication, you can create the `index.js` file with the following JavaScript module (index.mjs):
169+
```json
170+
{
171+
"compilerOptions": {
172+
"target": "es2022",
173+
"module": "es2022",
174+
"moduleResolution": "node",
175+
}
176+
}
177+
```
170178

171-
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index-using-password.mjs" :::
179+
1. Transpile from TypeScript to JavaScript.
172180

173-
---
181+
```shell
182+
tsc index.ts
183+
```
184+
185+
1. Sign in to Azure with the following command:
174186

175-
## Run the code
187+
```shell
188+
az login
189+
```
176190

177-
1. Sign in to Azure with `az login`.
191+
1. Run the code with the following command:
178192

179-
2. Run the code
193+
```shell
194+
node index.js
195+
```
180196

181-
#### [TypeScript](#tab/typescript)
197+
#### [JavaScript without key](#tab/javascript)
182198

183-
Transpile from TypeScript to JavaScript.
199+
1. Create the `index.js` file with the following **recommended** passwordless JavaScript module (index.mjs):
184200

185-
```shell
186-
tsc index.ts
187-
```
201+
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index.mjs" :::
188202

189-
Run the JavaScript file.
203+
1. Run the JavaScript file.
190204

191-
```shell
192-
node index.js
193-
```
205+
```shell
206+
node index.js
207+
```
194208

195-
#### [JavaScript](#tab/javascript)
209+
#### [JavaScript with key](#tab/javascript-key)
196210

197-
Run the JavaScript file.
211+
1. To use the service key for authentication, you can create the `index.js` file with the following JavaScript module (index.mjs):
198212

199-
```shell
200-
node index.js
201-
```
213+
:::code language="javascript" source="~/azure-typescript-e2e-apps/quickstarts/azure-openai-assistants/js/src/index-using-password.mjs" :::
214+
215+
1. Run the JavaScript file.
216+
217+
```shell
218+
node index.js
219+
```
202220

203221
```
204222

0 commit comments

Comments
 (0)