@@ -14,7 +14,7 @@ Create a client object, which will contain the connection string for connecting
14
14
``` python
15
15
import os
16
16
from azure.ai.projects import AIProjectClient
17
- from azure.ai.projects.models import FileSearchTool, VectorStoreDataSource, VectorStoreDataSourceAssetType
17
+ from azure.ai.projects.models import FileSearchTool
18
18
from azure.identity import DefaultAzureCredential
19
19
20
20
@@ -42,7 +42,7 @@ using NUnit.Framework;
42
42
// At the moment, it should be in the format "<HostName>;<AzureSubscriptionId>;<ResourceGroup>;<ProjectName>"
43
43
// Customer needs to login to Azure subscription via Azure CLI and set the environment variables
44
44
var connectionString = TestEnvironment .AzureAICONNECTIONSTRING ;
45
- AgentsClient client = new AgentsClient (connectionString , new DefaultAzureCredential ());
45
+ AgentsClient client = new AgentsClient (connectionString , new DefaultAzureCredentia ());
46
46
```
47
47
48
48
---
@@ -56,12 +56,17 @@ Vector stores are created using message attachments that have a default expirati
56
56
# [ Python] ( #tab/python )
57
57
58
58
``` python
59
- # We will upload the local file to Azure and will use it for vector store creation.
59
+ # We will upload the local file and will use it for vector store creation.
60
+
61
+ # upload a file
62
+ file = project_client.agents.upload_file_and_poll(file_path = ' ./data/product_info_1.md' , purpose = " assistants" )
63
+ print (f " Uploaded file, file ID: { file .id} " )
64
+
60
65
_, asset_uri = project_client.upload_file(" ./data/product_info_1.md" )
61
66
print (f " Uploaded file, asset URI: { asset_uri} " )
62
- # create a vector store with no file and wait for it to be processed
63
- ds = VectorStoreDataSource( asset_identifier = asset_uri, asset_type = VectorStoreDataSourceAssetType. URI_ASSET )
64
- vector_store = project_client.agents.create_vector_store_and_poll(data_sources = [ds ], name = " sample_vector_store " )
67
+
68
+ # create a vector store with the file you uploaded
69
+ vector_store = project_client.agents.create_vector_store_and_poll(file_ids = [ file .id ], name = " my_vectorstore " )
65
70
print (f " Created vector store, vector store ID: { vector_store.id} " )
66
71
```
67
72
0 commit comments