Code Monkey home page Code Monkey logo

Comments (3)

xiangyan99 avatar xiangyan99 commented on June 26, 2024

Thanks for the feedback, we’ll investigate asap.

from azure-sdk-for-python.

lmazuel avatar lmazuel commented on June 26, 2024

@aymenfurter I'm actually impressed that you were able to figure out this low level "continue polling" code. All my respect for that :)

The official way is something like (not tested, so a few adjustement may be necessary):

poller = client.begin_analyze_document(
   None,
   continuation_token=continuation_token
)

The code will bypass starting the operation, and recreate the poller. See here:

if cont_token is None:
raw_result = self._analyze_document_initial( # type: ignore
model_id=model_id,
analyze_request=analyze_request,
pages=pages,
locale=locale,
string_index_type=string_index_type,
features=features,
query_fields=query_fields,
output_content_format=output_content_format,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs,
)

It's not ideal that we have to pass a fake None to all required parameters, so I asked @kashifkhan to redesign, but it may take some time.

In the meantime, your code, or the official code, all works fine.

from azure-sdk-for-python.

aymenfurter avatar aymenfurter commented on June 26, 2024

Hi @lmazuel

Thank you for your reply with the clean code. This looks much more robust! 👍

Is there a way to access the underlying Operation-location instead of dealing with the continuation_token? Ideally, I would like to use the SDK to trigger the analysis request and then use the Operation-location to check the current status or retrieve the results, without going through the poller (essentially using the SDK as a thin layer over the API), or would you say in such a scenario it's better to directly interact with the REST API?

from azure-sdk-for-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.