Skip to content

Commit

Permalink
Feedback on SDK design/implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojunehsu committed Sep 28, 2021
1 parent e644d17 commit a498726
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ def begin_analyze_document(self, model, document, **kwargs):
:param str model: A unique model identifier can be passed in as a string.
Use this to specify the custom model ID or prebuilt model ID. Prebuilt model IDs to use are:
#### [Paul] Ideally, link to service documentation page listing all prebuilt models.

This comment has been minimized.

Copy link
@catalinaperalta

catalinaperalta Sep 28, 2021

Member

Do you have a link to the documentation we should use?

"prebuilt-receipt", "prebuilt-invoice", "prebuilt-idDocument", "prebuilt-businessCard",
"prebuilt-document", "prebuilt-layout".
:param document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
:type document: bytes or IO[bytes]
#### [Paul] Note with latest Swagger, pages should be just a string.

This comment has been minimized.

Copy link
@catalinaperalta

catalinaperalta Sep 28, 2021

Member

This has been updated here: #20867

:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
#### [Paul] Link to service documentation for supported locales for each model.
:keyword str locale: Locale hint of the input document.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:return: An instance of an LROPoller. Call `result()` on the poller
object to return a :class:`~azure.ai.formrecognizer.AnalyzeResult`.
Expand Down Expand Up @@ -137,13 +139,13 @@ def begin_analyze_document_from_url(self, model, document_url, **kwargs):
Use this to specify the custom model ID or prebuilt model ID. Prebuilt model IDs to use are:
"prebuilt-receipt", "prebuilt-invoice", "prebuilt-idDocument", "prebuilt-businessCard",
"prebuilt-document", "prebuilt-layout".
##### [Paul] What does "encoded URL" mean? May want to explicitly mention that it needs to be a publicly accessible URL.
:param str document_url: The URL of the document to analyze. The input must be a valid, encoded URL
of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
:keyword str locale: Locale hint of the input document.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:return: An instance of an LROPoller. Call `result()` on the poller
object to return a :class:`~azure.ai.formrecognizer.AnalyzeResult`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, endpoint, credential, **kwargs):
def begin_build_model(self, source, **kwargs):
# type: (str, Any) -> DocumentModelAdministrationLROPoller[DocumentModel]
"""Build a custom model.
##### [Paul] With BYOS tying a storage account to a FR resource, customers can specify a blob container without SAS token.
The request must include a `source` parameter that is an
externally accessible Azure storage blob container URI (preferably a Shared Access Signature URI). Note that
a container URI (without SAS) is accepted only when the container is public.
Expand Down Expand Up @@ -208,7 +208,7 @@ def _compose_callback(
component_models=[
self._generated_models.ComponentModelInfo(model_id=model_id)
for model_id in model_ids
] if model_ids else None
] if model_ids else []

This comment has been minimized.

Copy link
@catalinaperalta
),
cls=kwargs.pop("cls", _compose_callback),
polling=LROBasePolling(
Expand Down Expand Up @@ -249,6 +249,7 @@ def get_copy_authorization(self, **kwargs):
),
**kwargs
)
##### [Paul] I didn't trace. But I am surprised that serialize() returns dict.
target = response.serialize() # type: ignore
return target

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,7 @@ class BoundingRegion(object):
:ivar list[~azure.ai.formrecognizer.Point] bounding_box:
A list of 4 points representing the quadrilateral bounding box
that outlines the text. The points are listed in clockwise
##### [Paul] relative to the text orientation.
order: top-left, top-right, bottom-right, bottom-left.
Units are in pixels for images and inches for PDF.
:ivar int page_number:
Expand Down Expand Up @@ -2133,6 +2134,11 @@ def from_dict(cls, data):
)


##### [Paul] Suggest naming this DocumentContentElement.

This comment has been minimized.

Copy link
@catalinaperalta

catalinaperalta Sep 28, 2021

Member

We're going to look more deeply into this for beta.2. Here is the issue: #20921

##### Propose introducing DocumentPageElement for line, blocks;
##### and DocumentStructureElement for table, keyValuePair, fields, entities, etc.
##### [Paul] I was expecting to see Span and Confidence here.
##### [Paul] Having Content here is good. But since SelectionMark uses State, it may be useful to hide it from IntelliSense there.
class DocumentElement(object):
"""A DocumentElement.
Expand Down

0 comments on commit a498726

Please sign in to comment.