Skip to content

Commit 9235ec2

Browse files
author
Yalin Li
authored
[DI] Update resource setup script (#36182)
1 parent e3caf23 commit 9235ec2

File tree

8 files changed

+46
-200
lines changed

8 files changed

+46
-200
lines changed

sdk/documentintelligence/azure-ai-documentintelligence/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/documentintelligence/azure-ai-documentintelligence",
5-
"Tag": "python/documentintelligence/azure-ai-documentintelligence_d341ce7992"
5+
"Tag": "python/documentintelligence/azure-ai-documentintelligence_ea63c55a80"
66
}

sdk/documentintelligence/azure-ai-documentintelligence/samples/aio/sample_analyze_custom_documents_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
2) DOCUMENTINTELLIGENCE_API_KEY - your Document Intelligence API key.
2424
3) CUSTOM_BUILT_MODEL_ID - the ID of your custom built model.
2525
-OR-
26-
DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container with your training files.
26+
DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container with your training files.
2727
A model will be built and used to run the sample.
2828
"""
2929

@@ -62,7 +62,7 @@ def print_table(header_names, table_data):
6262

6363
async def analyze_custom_documents(custom_model_id):
6464
# For the Form_1.jpg, it should be the test file under the traning dataset which storage at the Azure Blob Storage path
65-
# combined by DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX,
65+
# combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX,
6666
# or it can also be a test file with the format similar to the training dataset.
6767
# Put it here locally just for presenting documents visually in sample.
6868

@@ -177,7 +177,7 @@ async def analyze_custom_documents(custom_model_id):
177177

178178
async def main():
179179
model_id = None
180-
if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"):
180+
if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"):
181181
import uuid
182182
from azure.core.credentials import AzureKeyCredential
183183
from azure.ai.documentintelligence.aio import DocumentIntelligenceAdministrationClient
@@ -193,7 +193,7 @@ async def main():
193193
if not endpoint or not key:
194194
raise ValueError("Please provide endpoint and API key to run the samples.")
195195

196-
blob_container_sas_url = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL")
196+
blob_container_sas_url = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL")
197197
blob_prefix = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_PREFIX")
198198
if blob_container_sas_url is not None:
199199
request = BuildDocumentModelRequest(

sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_custom_documents.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
2) DOCUMENTINTELLIGENCE_API_KEY - your Document Intelligence API key.
2424
3) CUSTOM_BUILT_MODEL_ID - the ID of your custom built model.
2525
-OR-
26-
DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container with your training files.
26+
DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container with your training files.
2727
A model will be built and used to run the sample.
2828
"""
2929

@@ -60,7 +60,7 @@ def print_table(header_names, table_data):
6060

6161
def analyze_custom_documents(custom_model_id):
6262
# For the Form_1.jpg, it should be the test file under the traning dataset which storage at the Azure Blob Storage path
63-
# combined by DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX,
63+
# combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX,
6464
# or it can also be a test file with the format similar to the training dataset.
6565
# Put it here locally just for presenting documents visually in sample.
6666

@@ -181,7 +181,7 @@ def analyze_custom_documents(custom_model_id):
181181
try:
182182
load_dotenv(find_dotenv())
183183
model_id = None
184-
if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"):
184+
if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"):
185185
import uuid
186186
from azure.core.credentials import AzureKeyCredential
187187
from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient
@@ -200,7 +200,7 @@ def analyze_custom_documents(custom_model_id):
200200
document_intelligence_admin_client = DocumentIntelligenceAdministrationClient(
201201
endpoint=endpoint, credential=AzureKeyCredential(key)
202202
)
203-
blob_container_sas_url = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL")
203+
blob_container_sas_url = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL")
204204
blob_prefix = os.getenv("DOCUMENTINTELLIGENCE_STORAGE_PREFIX")
205205
if blob_container_sas_url is not None:
206206
request = BuildDocumentModelRequest(

sdk/documentintelligence/azure-ai-documentintelligence/tests/preparers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
documentintelligence_api_key="fakeZmFrZV9hY29jdW50X2tleQ==",
2222
documentintelligence_storage_container_sas_url="https://blob_sas_url",
2323
documentintelligence_testing_data_container_sas_url="https://blob_sas_url",
24-
documentintelligence_multipage_storage_container_sas_url="https://blob_sas_url",
2524
documentintelligence_training_data_classifier_sas_url="https://blob_sas_url",
2625
documentintelligence_resource_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.CognitiveServices/accounts/documentintelligencename",
27-
documentintelligence_region="region",
26+
documentintelligence_resource_region="region",
2827
)
2928

3029

sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_classify_document(self, documentintelligence_training_data_classifier_s
7979
)
8080
document = poller.result()
8181
assert document.model_id == classifier.classifier_id
82-
assert len(document.pages) == 2
82+
assert len(document.pages) == 4
8383
assert document.tables is None
8484
assert document.paragraphs is None
8585
assert document.styles is None

sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def test_classify_document(self, documentintelligence_training_data_classi
8282
)
8383
document = await poller.result()
8484
assert document.model_id == classifier.classifier_id
85-
assert len(document.pages) == 2
85+
assert len(document.pages) == 4
8686
assert document.tables is None
8787
assert document.paragraphs is None
8888
assert document.styles is None

0 commit comments

Comments
 (0)