Skip to content

Commit fe6e7e8

Browse files
authored
Merge pull request #1874 from aahill/lindazqli
Bing updates
2 parents 44d89b9 + caac4b1 commit fe6e7e8

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

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

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,53 @@ recommendations: false
1919

2020
**Grounding with Bing Search** allows your Azure AI Agents to incorporate real-time public web data when generating responses. You need to create a Grounding with Bing Search resource, and then connect this resource to your Azure AI Agents. When a user sends a query, Azure AI Agents decide if Grounding with Bing Search should be leveraged or not. If so, it will leverage Bing to search over public web data and return relevant chunks. Lastly, Azure AI Agents will use returned chunks to generate a response.
2121

22-
You can ask questions such as "*what is the weather in Seattle?*" or "*what is the recent update in the retail industry in the US?*", which require real-time public data.
22+
You can ask questions such as "*what is the top news today*" or "*what is the recent update in the retail industry in the US?*", which require real-time public data.
2323

2424
Developers and end users don't have access to raw content returned from Grounding with Bing Search. The response, however, includes citations with links to the websites used to generate the response, and a link to the Bing query used for the search. These two *References* must be retained and displayed in the exact form provided by Microsoft, as per Grounding with Bing Search's [Use and Display Requirements](https://www.microsoft.com/en-us/bing/apis/grounding-legal#use-and-display-requirements). See the [how to display Grounding with Bing Search results](#how-to-display-grounding-with-bing-search-results) section for details.
2525

2626
>[!IMPORTANT]
27-
> Your usage of Grounding with Bing Search may incur costs. See the [pricing page](https://www.microsoft.com/bing/apis/grounding-pricing) for details.
27+
> 1. Your usage of Grounding with Bing Search may incur costs. See the [pricing page](https://www.microsoft.com/bing/apis/grounding-pricing) for details.
28+
> 1. If you choose to create a new Grounding with Bing Search resource programatically, such as the Azure CLI or using a deployment template, you automatically agree to be bound by and comply with the [terms of use and use and display requirements](https://www.microsoft.com/en-us/bing/apis/grounding-legal).
29+
2830

2931
## Setup
3032

31-
> [!IMPORTANT]
32-
> Grounding with Bing Search only works with the following AOAI models: `gpt-3.5-turbo-0125`, `gpt-4-0125-preview`, `gpt-4-turbo-2024-04-09`, `gpt-4o-0513`
33+
> [!NOTE]
34+
> Grounding with Bing Search only works with the following Azure OpenAI models: `gpt-3.5-turbo-0125`, `gpt-4-0125-preview`, `gpt-4-turbo-2024-04-09`, `gpt-4o-0513`
35+
36+
In one click, you can start creating a **new Azure AI Foundry project and Grounding with Bing Search resource** with the available [deployment template](../../quickstart.md#choose-basic-or-standard-agent-setup). After the deployment, you can find your resources including: an AI hub, project, Grounding with Bing Search resource and more created in your resource group. You can find your Grounding with Bing Search connection in the **connected resources** for your project in Azure AI Foundry portal.
3337

34-
1. Ensure you've completed the prerequisites and setup steps in the [quickstart](../../quickstart.md).
38+
:::image type="content" source="../../media/tools/bing/connected-resources.png" alt-text="A screenshot showing the connected resources for a project in the Azure AI Foundry portal." lightbox="../../media/tools/bing/connected-resources.png":::
3539

36-
1. Create a new Grounding with Bing Search resource. <!--You can find the template file [here](./bingsearch_arm.json) and parameter file [here](./bingsearch_para.json).-->
37-
You can do this directly in [Azure portal](https://portal.azure.com/#create/Microsoft.BingGroundingSearch), and select the different fields in the creation form.
40+
1. If you already have a Grounding with Bing Search resource, you can provide your resource ID in the bicep file. Your resource ID should be in this format `/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Bing/accounts/{resource name}`. Replace the following empty string with your resource ID:
41+
42+
```bicep
43+
@description('The full ARM Bing Resource ID. This is an optional field, and if not provided, the resource will be created.')
44+
param bingSearchResourceID string = ''
45+
```
3846
39-
Alternatively, you can create the resource through Azure CLI. By using this method, you automatically agree to be bound by and comply with the [Terms of use and Use and Display Requirements](https://www.microsoft.com/en-us/bing/apis/grounding-legal).
4047
41-
Make sure you create this Grounding with Bing Search resource in the same resource group as your Azure AI Agent, AI Project, and other resources.
48+
Alternatively, you can also follow the step-by-step guide below:
4249
43-
1. Ensure you have logged in to Azure, using `az login`
50+
1. Create a standard Azure AI Agent by following the steps in the [quickstart](../../quickstart.md).
51+
52+
1. Register the Bing Search provider.
4453
45-
1. Register the Bing Search provider
4654
```console
4755
az provider register --namespace 'Microsoft.Bing'
4856
```
4957

50-
1. Create the resource.
51-
52-
```console
53-
az deployment group create
54-
--name "$deployment_name"
55-
--resource-group "$resource_group"
56-
--template-file "$path_to_arm_template_file"
57-
--parameters "$path_to_parameters_file";
58-
```
59-
An example of the CLI command:
60-
```console
61-
az deployment group create
62-
--name az-cli-ARM-TEST
63-
--resource-group ApiSearch-Test-WestUS2
64-
--template-file bingsearch_arm.json
65-
--parameters bingsearch_para.json
66-
```
58+
1. Create a new Grounding with Bing Search resource in the [Azure portal](https://portal.azure.com/#create/Microsoft.BingGroundingSearch), and select the different fields in the creation form. Make sure you create this Grounding with Bing Search resource in the same resource group as your Azure AI Agent, AI Project, and other resources.
6759

68-
1. After you have created a Grounding with Bing Search resource, you can find it in [Azure portal](https://portal.azure.com/#home). Going to the resource group you have created the resource at, search for the Grounding with Bing Search resource you have created.
60+
1. After you have created a Grounding with Bing Search resource, you can find it in [Azure portal](https://portal.azure.com/#home). Navigate to the resource group you've created the resource in, search for the Grounding with Bing Search resource you have created.
6961

7062
:::image type="content" source="../../media/tools/bing/resource-azure-portal.png" alt-text="A screenshot of the Bing resource in the Azure portal." lightbox="../../media/tools/bing/resource-azure-portal.png":::
7163

7264
1. Select the Grounding with Bing Search resource you have created and copy any of the API keys.
7365

7466
:::image type="content" source="../../media/tools/bing/key-endpoint-resource-azure-portal.png" alt-text="A screenshot of the key and endpoint screen for the Bing resource in the Azure portal." lightbox="../../media/tools/bing/key-endpoint-resource-azure-portal.png":::
7567

76-
77-
78-
1. Go to [Azure AI Studio](https://ai.azure.com/) and select the AI Project (make sure it's in the same resource group of your Grounding with Bing Search resource). Click **Settings**.
68+
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/) and select the AI Project (make sure it's in the same resource group of your Grounding with Bing Search resource). Click **connected resources**.
7969

8070
:::image type="content" source="../../media/tools/bing/project-settings-button.png" alt-text="A screenshot of the settings button for an AI project." lightbox="../../media/tools/bing/project-settings-button.png":::
8171

@@ -102,6 +92,12 @@ Developers and end users don't have access to raw content returned from Groundin
10292

10393
According to Grounding with Bing's [terms of use and use and display requirements](https://www.microsoft.com/en-us/bing/apis/grounding-legal#use-and-display-requirements), you need to display both website URLs and Bing search query URLs in your custom interface. You can find website URLs through `annotations` parameter in API response and Bing search query URLs through `runstep` details.
10494

95+
```python
96+
run_steps = project_client.agents.list_run_steps(run_id=run.id, thread_id=thread.id)
97+
run_steps_data = run_steps['data']
98+
print(f"Last run step detail: {run_steps_data}")
99+
```
100+
105101
:::image type="content" source="../../media/tools/bing/website-citations.png" alt-text="A screenshot showing citations for Bing search results." lightbox="../../media/tools/bing/website-citations.png":::
106102

107103
### Other legal considerations
@@ -114,7 +110,7 @@ Your use of Grounding with Bing Search will be governed by the Terms of Use. By
114110

115111
::: zone pivot="code-example"
116112

117-
## Step 1: Create an agent with bing grounding
113+
## Step 1: Create an agent with Grounding with Bing Search
118114

119115
Create a client object, which will contain the connection string for connecting to your AI project and other resources.
120116

@@ -159,9 +155,9 @@ var projectClient = new AIProjectClient(connectionString, new DefaultAzureCreden
159155

160156
---
161157

162-
## Step 2: Enable the Bing search tool
158+
## Step 2: Enable the Grounding with Bing search tool
163159

164-
To make the Bing search tool available to your agent, create a Bing connection to initialize the Bing search tool and attach it to the agent.
160+
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.
165161

166162
# [Python](#tab/python)
167163

@@ -225,7 +221,7 @@ print(f"Created thread, ID: {thread.id}")
225221
message = project_client.agents.create_message(
226222
thread_id=thread.id,
227223
role="user",
228-
content="How is the weather in Seattle today?",
224+
content="What is the top news today",
229225
)
230226
print(f"Created message, ID: {message.id}")
231227
```
@@ -249,7 +245,7 @@ ThreadMessage message = messageResponse.Value;
249245

250246
## Step 4: Create a run and check the output
251247

252-
Create a run and observe that the model uses the file search tool to provide a response to the user's question.
248+
Create a run and observe that the model uses the Grounding with Bing Search tool to provide a response to the user's question.
253249

254250
# [Python](#tab/python)
255251

223 KB
Loading

0 commit comments

Comments
 (0)