Skip to content

Commit 565ddbc

Browse files
committed
updating blob storage code
1 parent 736e864 commit 565ddbc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

articles/ai-services/agents/includes/file-search/azure-blob-storage-code-examples.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ ms.date: 12/10/2024
1111
In this example, we use Azure AI Agent Service to create an agent that can help answer questions on information from files in Azure Blob Storage.
1212

1313
### Prerequisites
14-
Complete the [standard agent setup](../../quickstart.md).
14+
1. Complete the [standard agent setup](../../quickstart.md).
15+
16+
2. Ensure that you have the role **Storage Blob Data Contributor** on your project's storage account.
17+
1518

1619
> [!IMPORTANT]
1720
> File search using Blob storage is only supported by the standard agent setup.
@@ -36,12 +39,14 @@ project_client = AIProjectClient.from_connection_string(
3639

3740
### Step 2: Upload local files to your project Azure Blob Storage container
3841
Upload your local file to the project’s Azure Blob Storage container. This is the same storage account you connected to your agent during setup. If you create more agents in the same project that need to use the uploaded file(s), you can reuse this asset uri, avoiding the need to upload the file multiple times.
42+
43+
Then, create a vector store using the ```asset_uri```, which is the location of your file in your project's datastore.
3944
```python
4045
# We'll upload the local file to your project Azure Blob Storage container and will use it for vector store creation.
4146
_, asset_uri = project_client.upload_file("sample_file_for_upload.md")
4247
print(f"Uploaded file, asset URI: {asset_uri}")
4348

44-
# create a vector store with no file and wait for it to be processed
49+
# create a vector store with a file in blob storage and wait for it to be processed
4550
ds = VectorStoreDataSource(asset_identifier=asset_uri, asset_type=VectorStoreDataSourceAssetType.URI_ASSET)
4651
vector_store = project_client.agents.create_vector_store_and_poll(data_sources=[ds], name="sample_vector_store")
4752
print(f"Created vector store, vector store ID: {vector_store.id}")
@@ -101,7 +106,7 @@ file_search_tool_2 = FileSearchTool(vector_store_ids=[vector_store_2.id])
101106
# notices that FileSearchTool as tool and tool_resources must be added or the assistant unable to search the file
102107
agent_2 = project_client.agents.create_agent(
103108
model="gpt-4o-mini",
104-
name="my-assistant",
109+
name="my-assistant-2",
105110
instructions="You are helpful assistant",
106111
tools=file_search_tool_2.definitions,
107112
tool_resources=file_search_tool_2.resources,

0 commit comments

Comments
 (0)