Skip to content

Commit b7d8d3a

Browse files
Merge pull request #5539 from MicrosoftDocs/main
Merged by Learn.Build PR Management system
2 parents 0496181 + db8b8fa commit b7d8d3a

File tree

5 files changed

+165
-181
lines changed

5 files changed

+165
-181
lines changed

articles/ai-foundry/what-is-azure-ai-foundry.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: sdgilley
66
ms.author: sgilley
77
manager: scottpolly
88
ms.reviewer: sgilley
9-
ms.date: 05/12/2025
9+
ms.date: 06/12/2025
1010
ms.service: azure-ai-foundry
1111
ms.topic: overview
1212
ms.custom:
@@ -58,14 +58,16 @@ This table summarizes features available in the two project types:
5858
| Capability | [!INCLUDE [fdp](includes/fdp-project-name.md)] | [!INCLUDE[hub](includes/hub-project-name.md)] |
5959
| --- | --- | --- |
6060
| Agents | ✅ (GA) | ✅ (Preview only) |
61-
| Azure AI Foundry Models including Azure OpenAI models | ✅ (Native support) | Available via connections |
6261
| AI Foundry API to work with agents and across models| ✅ (Native support) | Available via connections |
63-
| Project files (directly upload files and start experimenting) || |
64-
| Project-level isolation of files and outputs |||
62+
| Models sold directly by Azure - Azure OpenAI, DeepSeek, xAI, etc. || Available via connections |
63+
| Partner & Community Models sold through Marketplace - Stability, Bria, Cohere, etc. || Available via connections |
64+
| Open source models e.g. HuggingFace | ||
6565
| Evaluations |||
6666
| Playground |||
6767
| Prompt flow | ||
68-
| Managed compute | ||
68+
| Content understanding | ||
69+
| Project files (directly upload files and start experimenting) || |
70+
| Project-level isolation of files and outputs |||
6971
| Required Azure dependencies | - | Azure Storage account, Azure Key Vault |
7072

7173
### <a name="how-do-i-know"></a> How do I know which type of project I have?

articles/search/includes/quickstarts/agentic-retrieval-python.md

Lines changed: 58 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: haileytap
44
ms.author: haileytapia
55
ms.service: azure-ai-search
66
ms.topic: include
7-
ms.date: 05/30/2025
7+
ms.date: 6/15/2025
88
---
99

1010
[!INCLUDE [Feature preview](../previews/preview-generic.md)]
@@ -21,101 +21,38 @@ This quickstart is based on the [Quickstart-Agentic-Retrieval](https://github.co
2121

2222
+ An [Azure AI Search service](../../search-create-service-portal.md) on the Basic tier or higher with [semantic ranker enabled](../../semantic-how-to-enable-disable.md).
2323

24-
+ An [Azure OpenAI resource](/azure/ai-services/openai/how-to/create-resource).
24+
+ An [Azure AI Foundry project](/azure/ai-foundry/how-to/create-projects). You get an Azure AI Foundry resource (that's needed for model deployments) when you create an Azure AI Foundry project.
2525

2626
+ [Visual Studio Code](https://code.visualstudio.com/download) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Jupyter package](https://pypi.org/project/jupyter/).
2727

28-
## Deploy models
28+
+ The [Azure CLI](/cli/azure/install-azure-cli) for keyless authentication with Microsoft Entra ID.
2929

30-
To run agentic retrieval, you must deploy the following models to your Azure OpenAI resource:
30+
[!INCLUDE [Setup](./agentic-retrieval-setup.md)]
3131

32-
+ An LLM for query planning.
33-
34-
+ An LLM for answer generation.
35-
36-
+ (Optional) An embedding model for vector queries.
37-
38-
Agentic retrieval [supports several models](../../search-agentic-retrieval-how-to-create.md#supported-models), but this quickstart assumes `gpt-4o-mini` for both LLMs and `text-embedding-3-large` for the embedding model.
39-
40-
To deploy the Azure OpenAI models:
41-
42-
1. Sign in to the [Azure AI Foundry portal](https://ai.azure.com/?cid=learnDocs) and select your Azure OpenAI resource.
43-
44-
1. From the left pane, select **Model catalog**.
45-
46-
1. Select **gpt-4o-mini**, and then select **Use this model**.
47-
48-
1. Specify a deployment name. To simplify your code, we recommend **gpt-4o-mini**.
49-
50-
1. Accept the defaults.
51-
52-
1. Select **Deploy**.
53-
54-
1. Repeat the previous steps for **text-embedding-3-large**.
55-
56-
## Configure role-based access
57-
58-
Azure AI Search needs access to your Azure OpenAI models. For this task, you can use API keys or Microsoft Entra ID with role assignments. Keys are easier to start with, but roles are more secure. This quickstart assumes roles.
59-
60-
To configure the recommended role-based access:
61-
62-
1. Sign in to the [Azure portal](https://portal.azure.com/).
63-
64-
1. [Enable role-based access](../../search-security-enable-roles.md) on your Azure AI Search service.
65-
66-
1. [Create a system-assigned managed identity](../../search-howto-managed-identities-data-sources.md#create-a-system-managed-identity) on your Azure AI Search service.
67-
68-
1. On your Azure AI Search service, [assign the following roles](../../search-security-rbac.md#how-to-assign-roles-in-the-azure-portal) to yourself.
69-
70-
+ **Search Service Contributor**
71-
72-
+ **Search Index Data Contributor**
73-
74-
+ **Search Index Data Reader**
75-
76-
1. On your Azure OpenAI resource, assign **Cognitive Services User** to the managed identity of your search service.
77-
78-
## Get endpoints
79-
80-
In your code, you specify the following endpoints to establish connections with Azure AI Search and Azure OpenAI. These steps assume that you configured role-based access in the previous section.
81-
82-
To obtain your service endpoints:
83-
84-
1. Sign in to the [Azure portal](https://portal.azure.com/).
85-
86-
1. On your Azure AI Search service:
87-
88-
1. From the left pane, select **Overview**.
89-
90-
1. Copy the URL, which should be similar to `https://my-service.search.windows.net`.
91-
92-
1. On your Azure OpenAI resource:
32+
## Connect from your local system
9333

94-
1. From the left pane, select **Resource Management** > **Keys and Endpoint**.
34+
You configured role-based access to interact with Azure AI Search and Azure OpenAI.
9535

96-
1. Copy the URL, which should be similar to `https://my-resource.openai.azure.com`.
36+
To connect from your local system:
9737

98-
## Connect from your local system
38+
1. Open a new terminal in Visual Studio Code and change to the directory where you want to save your files.
39+
1. Run the following Azure CLI command and sign in with your Azure account. If you have multiple subscriptions, select the one that contains your Azure AI Search service and Azure AI Foundry project.
9940

100-
You configured role-based access to interact with Azure AI Search and Azure OpenAI. From the command line, use the Azure CLI to sign in to the same subscription and tenant for both services. For more information, see [Quickstart: Connect without keys](../../search-get-started-rbac.md).
101-
102-
```azurecli
103-
az account show
41+
```azurecli
42+
az login
43+
```
10444
105-
az account set --subscription <PUT YOUR SUBSCRIPTION ID HERE>
106-
107-
az login --tenant <PUT YOUR TENANT ID HERE>
108-
```
45+
For more information, see [Quickstart: Connect without keys](../../search-get-started-rbac.md).
10946
11047
## Install packages and load connections
11148
11249
Before you run any code, install Python packages and define credentials, endpoints, and deployment details for connections to Azure AI Search and Azure OpenAI. These values are used in subsequent operations.
11350
11451
To install the packages and load the connections:
11552
116-
1. In Visual Studio Code, create a `.ipynb` file.
53+
1. In Visual Studio Code, create a `.ipynb` file. For example, you can name the file `quickstart-agentic-retrieval.ipynb`.
11754
118-
1. Install the following packages.
55+
1. In the first code cell, paste the following code to install the required packages.
11956
12057
```Python
12158
! pip install azure-search-documents==11.6.0b12 --quiet
@@ -126,7 +63,9 @@ To install the packages and load the connections:
12663
! pip install requests --quiet
12764
```
12865
129-
1. In another code cell, paste the following import statements and variables.
66+
You can run this cell by selecting the **Run Cell** button or pressing `Shift+Enter`.
67+
68+
1. Add another code cell and paste the following import statements and variables.
13069
13170
```Python
13271
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
@@ -135,26 +74,28 @@ To install the packages and load the connections:
13574
endpoint = "PUT YOUR SEARCH SERVICE ENDPOINT HERE"
13675
credential = DefaultAzureCredential()
13776
token_provider = get_bearer_token_provider(credential, "https://search.azure.com/.default")
138-
azure_openai_endpoint = "PUT YOUR AZURE OPENAI ENDPOINT HERE"
139-
azure_openai_gpt_deployment = "gpt-4o-mini"
140-
azure_openai_gpt_model = "gpt-4o-mini"
77+
azure_openai_endpoint = "PUT YOUR AZURE AI FOUNDRY ENDPOINT HERE"
78+
azure_openai_gpt_deployment = "gpt-4.1-mini"
79+
azure_openai_gpt_model = "gpt-4.1-mini"
14180
azure_openai_api_version = "2025-03-01-preview"
14281
azure_openai_embedding_deployment = "text-embedding-3-large"
14382
azure_openai_embedding_model = "text-embedding-3-large"
14483
index_name = "earth_at_night"
14584
agent_name = "earth-search-agent"
146-
answer_model = "gpt-4o-mini"
85+
answer_model = "gpt-4.1-mini"
14786
api_version = "2025-05-01-Preview"
14887
```
14988
150-
1. Replace `endpoint` and `azure_openai_endpoint` with the values you obtained in [Get endpoints](#get-endpoints).
89+
1. Set `endpoint` to your Azure AI Search endpoint, which looks like `https://<your-search-service-name>.search.windows.net.` Set `azure_openai_endpoint` to your Azure AI Foundry endpoint, which looks like `https://<your-foundry-resource-name>.openai.azure.com.` You obtained both values in the [Get endpoints](#get-endpoints) section.
15190
15291
1. To verify the variables, run the code cell.
15392
15493
## Create a search index
15594
15695
In Azure AI Search, an index is a structured collection of data. The following code defines an index named `earth_at_night`, which you specified using the `index_name` variable in the previous section.
15796
97+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
98+
15899
```Python
159100
from azure.search.documents.indexes.models import SearchIndex, SearchField, VectorSearch, VectorSearchProfile, HnswAlgorithmConfiguration, AzureOpenAIVectorizer, AzureOpenAIVectorizerParameters, SemanticSearch, SemanticConfiguration, SemanticPrioritizedFields, SemanticField
160101
from azure.search.documents.indexes import SearchIndexClient
@@ -215,6 +156,8 @@ The index schema contains fields for document identification and page content, e
215156

216157
Currently, the `earth_at_night` index is empty. Run the following code to populate the index with JSON documents from NASA's Earth at Night e-book. As required by Azure AI Search, each document conforms to the fields and data types defined in the index schema.
217158

159+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
160+
218161
```Python
219162
from azure.search.documents import SearchIndexingBufferedSender
220163
import requests
@@ -230,10 +173,12 @@ print(f"Documents uploaded to index '{index_name}'")
230173

231174
## Create a knowledge agent
232175

233-
To connect Azure AI Search to your `gpt-4o-mini` deployment and target the `earth_at_night` index at query time, you need a knowledge agent. The following code defines a knowledge agent named `earth-search-agent`, which you specified using the `agent_name` variable in a previous section.
176+
To connect Azure AI Search to your `gpt-4.1-mini` deployment and target the `earth_at_night` index at query time, you need a knowledge agent. The following code defines a knowledge agent named `earth-search-agent`, which you specified using the `agent_name` variable in a previous section.
234177

235178
To ensure relevant and semantically meaningful responses, `default_reranker_threshold` is set to exclude responses with a reranker score of `2.5` or lower.
236179

180+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
181+
237182
```Python
238183
from azure.search.documents.indexes.models import KnowledgeAgent, KnowledgeAgentAzureOpenAIModel, KnowledgeAgentTargetIndex, KnowledgeAgentRequestLimits, AzureOpenAIVectorizerParameters
239184

@@ -266,6 +211,8 @@ The next step is to define the knowledge agent instructions and conversation con
266211

267212
For now, create the following assistant message, which instructs `earth-search-agent` to answer questions about the Earth at night, cite sources using their `ref_id`, and respond with "I don't know" when answers are unavailable.
268213

214+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
215+
269216
```Python
270217
instructions = """
271218
An Q&A agent that can answer questions about the Earth at night.
@@ -287,6 +234,8 @@ You're ready to initiate the agentic retrieval pipeline. The input for this pipe
287234

288235
The following code sends a two-part user query to `earth-search-agent`, which deconstructs the query into subqueries, runs the subqueries against both text fields and vector embeddings in the `earth_at_night` index, and ranks and merges the results. The response is then appended to the `messages` array.
289236

237+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
238+
290239
```Python
291240
from azure.search.documents.agent import KnowledgeAgentRetrievalClient
292241
from azure.search.documents.agent.models import KnowledgeAgentRetrievalRequest, KnowledgeAgentMessage, KnowledgeAgentMessageTextContent, KnowledgeAgentIndexParams
@@ -315,7 +264,9 @@ messages.append({
315264

316265
### Review the response, activity, and results
317266

318-
To output the response, activity, and results of the retrieval pipeline, run the following code.
267+
Now you want to display the response, activity, and results of the retrieval pipeline.
268+
269+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
319270

320271
```Python
321272
import textwrap
@@ -335,7 +286,7 @@ The output should be similar to the following example, where:
335286

336287
+ `Response` provides a text string of the most relevant documents (or chunks) in the search index based on the user query. As shown later in this quickstart, you can pass this string to an LLM for answer generation.
337288

338-
+ `Activity` tracks the steps that were taken during the retrieval process, including the subqueries generated by your `gpt-4o-mini` deployment and the tokens used for query planning and execution.
289+
+ `Activity` tracks the steps that were taken during the retrieval process, including the subqueries generated by your `gpt-4.1-mini` deployment and the tokens used for query planning and execution.
339290

340291
+ `Results` lists the documents that contributed to the response, each one identified by their `doc_key`.
341292

@@ -391,7 +342,9 @@ Results
391342

392343
## Create the Azure OpenAI client
393344

394-
To extend the retrieval pipeline from answer *extraction* to answer *generation*, set up the Azure OpenAI client to interact with your `gpt-4o-mini` deployment, which you specified using the `answer_model` variable in a previous section.
345+
To extend the retrieval pipeline from answer *extraction* to answer *generation*, set up the Azure OpenAI client to interact with your `gpt-4.1-mini` deployment, which you specified using the `answer_model` variable in a previous section.
346+
347+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
395348

396349
```Python
397350
from openai import AzureOpenAI
@@ -407,7 +360,9 @@ client = AzureOpenAI(
407360

408361
### Use the Responses API to generate an answer
409362

410-
You can now use the Responses API to generate a detailed answer based on the indexed documents. The following code sends the `messages` array, which contains the conversation history, to your `gpt-4o-mini` deployment.
363+
You can now use the Responses API to generate a detailed answer based on the indexed documents. The following code sends the `messages` array, which contains the conversation history, to your `gpt-4.1-mini` deployment.
364+
365+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
411366

412367
```Python
413368
response = client.responses.create(
@@ -419,7 +374,7 @@ wrapped = textwrap.fill(response.output_text, width=100)
419374
print(wrapped)
420375
```
421376

422-
The output should be similar to the following example, which uses the reasoning capabilities of `gpt-4o-mini` to provide contextually relevant answers.
377+
The output should be similar to the following example, which uses the reasoning capabilities of `gpt-4.1-mini` to provide contextually relevant answers.
423378

424379
```
425380
Suburban belts often exhibit larger December brightening than urban cores primarily because of the type of development and light distribution in those areas. Suburbs tend to have more uniform and expansive lighting, making them more visible in nighttime satellite images. In contrast, urban cores, although having higher absolute light levels, often contain dense building clusters that can cause light to be obscured or concentrated in smaller areas, leading to less visible brightening when viewed from space. Regarding the visibility of the Phoenix nighttime street grid from space, it is attributed to the city's grid layout and the intensity of its street lighting. The grid pattern of the streets and the significant development around them create a stark contrast against less developed areas. Conversely, large stretches of interstate in the Midwest may remain dimmer due to fewer densely populated structures and less intensive street lighting, resulting in less illumination overall. For more detailed insights, you can refer to the sources: [0] and [1].
@@ -429,6 +384,8 @@ Suburban belts often exhibit larger December brightening than urban cores primar
429384

430385
Alternatively, you can use the Chat Completions API for answer generation.
431386

387+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
388+
432389
```Python
433390
response = client.chat.completions.create(
434391
model=answer_model,
@@ -449,6 +406,8 @@ Suburban belts tend to display larger December brightening than urban cores, des
449406

450407
Continue the conversation by sending another user query to `earth-search-agent`. The following code reruns the retrieval pipeline, fetching relevant content from the `earth_at_night` index and appending the response to the `messages` array. However, unlike before, you can now use the Azure OpenAI client to generate an answer based on the retrieved content.
451408

409+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
410+
452411
```Python
453412
messages.append({
454413
"role": "user",
@@ -469,7 +428,9 @@ messages.append({
469428

470429
### Review the new response, activity, and results
471430

472-
To output the latest response, activity, and results of the retrieval pipeline, run the following code.
431+
Now you want to display the response, activity, and results of the retrieval pipeline.
432+
433+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
473434

474435
```Python
475436
import textwrap
@@ -489,6 +450,8 @@ print(json.dumps([r.as_dict() for r in retrieval_result.references], indent=2))
489450

490451
Now that you've sent multiple user queries, use the Responses API to generate an answer based on the indexed documents and conversation history, which is captured in the `messages` array.
491452

453+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
454+
492455
```Python
493456
response = client.responses.create(
494457
model=answer_model,
@@ -513,6 +476,8 @@ In the Azure portal, you can find and manage resources by selecting **All resour
513476

514477
### Delete the knowledge agent
515478

479+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
480+
516481
```Python
517482
index_client = SearchIndexClient(endpoint=endpoint, credential=credential)
518483
index_client.delete_agent(agent_name)
@@ -521,6 +486,8 @@ print(f"Knowledge agent '{agent_name}' deleted successfully")
521486

522487
### Delete the search index
523488

489+
Add and run a new code cell in the `quickstart-agentic-retrieval.ipynb` notebook with the following code:
490+
524491
```Python
525492
index_client = SearchIndexClient(endpoint=endpoint, credential=credential)
526493
index_client.delete_index(index_name)

0 commit comments

Comments
 (0)