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
First, initialize a new TypeScript project by running:
29
27
30
28
```console
31
29
npm init -y
30
+
npm pkg set type="module"
32
31
```
33
32
34
33
Run the following commands to install the npm packages required.
35
34
36
35
```console
37
36
npm install @azure/ai-agents @azure/identity
38
-
npm install dotenv
37
+
npm install @types/node typescript --save-dev
39
38
```
40
39
41
40
Next, to authenticate your API requests and run the program, use the [az login](/cli/azure/authenticate-azure-cli-interactively) command to sign into your Azure subscription.
@@ -44,7 +43,7 @@ Next, to authenticate your API requests and run the program, use the [az login](
44
43
az login
45
44
```
46
45
47
-
Use the following code to create and run an agent which uploads [a CSV file](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-agents/data/syntheticCompanyQuarterlyResults.csv) of data then generates a bar chart from that data. To run this code, you'll need to get the endpoint for your project. This string is in the format:
46
+
Use the following code to answer the math question `I need to solve the equation '3x + 11 = 14'. Can you help me?`. To run this code, you'll need to get the endpoint for your project. This string is in the format:
@@ -60,190 +59,73 @@ Save the name of your model deployment name as an environment variable named `MO
60
59
> * This quickstart code uses environment variables for sensitive configuration. Never commit your `.env` file to version control by making sure `.env` is listed in your `.gitignore` file.
61
60
> *_Remember: If you accidentally commit sensitive information, consider those credentials compromised and rotate them immediately._
62
61
62
+
Create a tsconfig.json file with the following content:
Run the code using `npx tsx -r dotenv/config index.ts`. This code answers the question `I need to solve the equation '3x + 11 = 14'. Can you help me?`. Responses aren't deterministic, your output will look similar to the below output:
71
+
72
+
```console
73
+
Created agent, agent ID : asst_X4yDNWrdWKb8LN0SQ6xlzhWk
74
+
Created thread, thread ID : thread_TxqZcHL2BqkNWl9dFzBYMIU6
75
+
Threads for agent asst_X4yDNWrdWKb8LN0SQ6xlzhWk:
76
+
...
77
+
Created message, message ID : msg_R0zDsXdc2UbfsNXvS1zeS6hk
Run the code using `node index.js`. This code generates a bar chart PNG image file in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provided the file to you. Full [sample source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-agents/samples/v1-beta/typescript/src/codeInterpreterWithStreaming.ts) available.
131
+
Full [sample source code](https://github.com/Azure-Samples/azure-sdk-for-js-docs/blob/main/samples/foundry/azure-ai-agents-quickstart-math) available.
0 commit comments