Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[documentintelligence] Release prep #38929

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading