Skip to content

Commit

Permalink
[documentintelligence] Release prep (#38929)
Browse files Browse the repository at this point in the history
* run snippet updater

* update changelog

---------

Co-authored-by: catalinaperalta <[email protected]>
  • Loading branch information
catalinaperalta and cperaltah authored Dec 18, 2024
1 parent 13e01ff commit 90ac3ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0 (Unreleased)
## 1.0.0 (2024-12-17)

### Features Added

Expand Down Expand Up @@ -30,8 +30,6 @@
- Removed model `AnalyzeResultOperation`.
- Removed `GENERATIVE ` in enum `DocumentBuildMode`.

### Bugs Fixed

### Other Changes

- Changed the default service API version to `2024-11-30`.
Expand Down
16 changes: 6 additions & 10 deletions sdk/documentintelligence/azure-ai-documentintelligence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
with open(path_to_sample_documents, "rb") as f:
poller = document_intelligence_client.begin_analyze_document(
"prebuilt-layout", body=f
)
poller = document_intelligence_client.begin_analyze_document("prebuilt-layout", body=f)
result: AnalyzeResult = poller.result()

if result.styles and any([style.is_handwritten for style in result.styles]):
Expand Down Expand Up @@ -503,16 +501,16 @@ from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.ai.documentintelligence.models import AnalyzeResult

def _format_price(price_dict):
if price_dict is None:
return "N/A"
return "".join([f"{p}" for p in price_dict.values()])

endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
with open(path_to_sample_documents, "rb") as f:
poller = document_intelligence_client.begin_analyze_document(
"prebuilt-receipt", body=f, locale="en-US"
)
poller = document_intelligence_client.begin_analyze_document("prebuilt-receipt", body=f, locale="en-US")
receipts: AnalyzeResult = poller.result()

if receipts.documents:
Expand Down Expand Up @@ -665,9 +663,7 @@ document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, cre

# Make sure your document's type is included in the list of document types the custom model can analyze
with open(path_to_sample_documents, "rb") as f:
poller = document_intelligence_client.begin_analyze_document(
model_id=model_id, body=f
)
poller = document_intelligence_client.begin_analyze_document(model_id=model_id, body=f)
result: AnalyzeResult = poller.result()

if result.documents:
Expand Down Expand Up @@ -921,7 +917,7 @@ def callback(response):

client.get_resource_details(raw_response_hook=callback)

print(f"Response status code is: {responses["status_code"]}")
print(f"Response status code is: {responses['status_code']}")
response_body = responses["response_body"]
print(
f"Our resource has {response_body['customDocumentModels']['count']} custom models, "
Expand Down

0 comments on commit 90ac3ab

Please sign in to comment.