Skip to content

Commit 6d06063

Browse files
authored
Update bing-code-samples.md
update REST API
1 parent 8ea5e7e commit 6d06063

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

articles/ai-services/agents/how-to/tools/bing-code-samples.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,16 @@ Create a client object, which will contain the connection string for connecting
401401
>[!IMPORTANT]
402402
> 1. This REST API allows developers to invoke the Grounding with Bing Search tool through the Azure AI Foundry Agent Service. It does not send calls to the Grounding with Bing Search API directly.
403403
404-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN` and `AZURE_AI_AGENTS_ENDPOINT`. The client creation is demonstrated in the next section.
404+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`. The client creation is demonstrated in the next section.
405405
406406
407407
## Create an Agent with the Grounding with Bing search tool enabled
408408
409409
To make the Grounding with Bing search tool available to your agent, use a connection to initialize the tool and attach it to the agent. You can find your connection in the **connected resources** section of your project in the [Azure AI Foundry portal](https://ai.azure.com/).
410410
411411
```console
412-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=2025-05-01 \
412+
curl --request POST \
413+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
413414
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
414415
-H "Content-Type: application/json" \
415416
-d '{
@@ -438,7 +439,8 @@ curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=2025-05-01 \
438439
## Create a thread
439440
440441
```console
441-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=2025-05-01 \
442+
curl --request POST \
443+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
442444
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
443445
-H "Content-Type: application/json" \
444446
-d ''
@@ -447,7 +449,8 @@ curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=2025-05-01 \
447449
## Add a user question to the thread
448450
449451
```console
450-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-01 \
452+
curl --request POST \
453+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
451454
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
452455
-H "Content-Type: application/json" \
453456
-d '{
@@ -461,7 +464,8 @@ curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-versi
461464
Create a run and observe that the model uses the Grounding with Bing Search tool to provide a response to the user's question.
462465
463466
```console
464-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=2025-05-01 \
467+
curl --request POST \
468+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
465469
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
466470
-H "Content-Type: application/json" \
467471
-d '{
@@ -472,19 +476,21 @@ curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=2
472476
### Retrieve the status of the run
473477
474478
```console
475-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=2025-05-01 \
479+
curl --request GET \
480+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
476481
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
477482
```
478483
479484
### Retrieve the agent response
480485
481486
```console
482-
curl $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-01 \
487+
curl --request GET \
488+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
483489
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
484490
```
485491
486492
::: zone-end
487493
488494
## Next steps
489495
490-
[See the full sample for Grounding with Bing Search.](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_bing_grounding.py)
496+
[See the full sample for Grounding with Bing Search.](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_bing_grounding.py)

0 commit comments

Comments
 (0)