44
55from mindee .error .mindee_error import MindeeClientError , MindeeError
66from mindee .error .mindee_http_error import handle_error
7+ from mindee .input import WorkflowOptions
78from mindee .input .local_response import LocalResponse
89from mindee .input .page_options import PageOptions
910from mindee .input .sources import (
2526from mindee .mindee_http .workflow_endpoint import WorkflowEndpoint
2627from mindee .mindee_http .workflow_settings import WorkflowSettings
2728from mindee .parsing .common .async_predict_response import AsyncPredictResponse
28- from mindee .parsing .common .execution_priority import ExecutionPriority
2929from mindee .parsing .common .feedback_response import FeedbackResponse
3030from mindee .parsing .common .inference import Inference
3131from mindee .parsing .common .predict_response import PredictResponse
@@ -239,10 +239,8 @@ def execute_workflow(
239239 self ,
240240 input_source : Union [LocalInputSource , UrlInputSource ],
241241 workflow_id : str ,
242+ options : Optional [WorkflowOptions ] = None ,
242243 page_options : Optional [PageOptions ] = None ,
243- alias : Optional [str ] = None ,
244- priority : Optional [ExecutionPriority ] = None ,
245- full_text : bool = False ,
246244 ) -> WorkflowResponse :
247245 """
248246 Send the document to an asynchronous endpoint and return its ID in the queue.
@@ -252,9 +250,7 @@ def execute_workflow(
252250 :param workflow_id: ID of the workflow.
253251 :param page_options: If set, remove pages from the document as specified. This is done before sending the file\
254252 to the server. It is useful to avoid page limitations.
255- :param alias: Optional alias for the document.
256- :param priority: Optional priority for the document.
257- :param full_text: Whether to include the full OCR text response in compatible APIs.
253+ :param options: Options for the workflow.
258254 :return:
259255 """
260256 if isinstance (input_source , LocalInputSource ):
@@ -267,9 +263,12 @@ def execute_workflow(
267263
268264 logger .debug ("Sending document to workflow: %s" , workflow_id )
269265
270- return self ._send_to_workflow (
271- GeneratedV1 , input_source , workflow_id , alias , priority , full_text
272- )
266+ if not options :
267+ options = WorkflowOptions (
268+ alias = None , priority = None , full_text = False , public_url = None
269+ )
270+
271+ return self ._send_to_workflow (GeneratedV1 , input_source , workflow_id , options )
273272
274273 def _validate_async_params (
275274 self , initial_delay_sec : float , delay_sec : float , max_retries : int
@@ -484,9 +483,7 @@ def _send_to_workflow(
484483 product_class : Type [Inference ],
485484 input_source : Union [LocalInputSource , UrlInputSource ],
486485 workflow_id : str ,
487- alias : Optional [str ] = None ,
488- priority : Optional [ExecutionPriority ] = None ,
489- full_text : bool = False ,
486+ options : WorkflowOptions ,
490487 ) -> WorkflowResponse :
491488 """
492489 Sends a document to a workflow.
@@ -497,9 +494,7 @@ def _send_to_workflow(
497494 :param input_source: The document/source file to use.
498495 Has to be created beforehand.
499496 :param workflow_id: ID of the workflow.
500- :param alias: Optional alias for the document.
501- :param priority: Priority for the document.
502- :param full_text: Whether to include the full OCR text response in compatible APIs.
497+ :param options: Optional options for the workflow.
503498 :return:
504499 """
505500 if input_source is None :
@@ -509,9 +504,7 @@ def _send_to_workflow(
509504 WorkflowSettings (api_key = self .api_key , workflow_id = workflow_id )
510505 )
511506
512- response = workflow_endpoint .workflow_execution_post (
513- input_source , alias , priority , full_text
514- )
507+ response = workflow_endpoint .workflow_execution_post (input_source , options )
515508
516509 dict_response = response .json ()
517510
0 commit comments