Skip to content

Latest commit

 

History

History
423 lines (283 loc) · 39.9 KB

File metadata and controls

423 lines (283 loc) · 39.9 KB

Workflows

Overview

Available Operations

get_workflows

Get Workflows

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.get_workflows(active_only=False, include_shared=True, limit=50)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description
active_only Optional[bool] Whether to only return active workflows
include_shared Optional[bool] Whether to include shared workflows
available_in_chat_assistant OptionalNullable[bool] Whether to only return workflows compatible with chat assistant
archived OptionalNullable[bool] Filter by archived state. False=exclude archived, True=only archived, None=include all
cursor OptionalNullable[str] The cursor for pagination
limit Optional[int] The maximum number of workflows to return
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetWorkflowsV1WorkflowsGetResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_workflow_registrations

Get Workflow Registrations

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.get_workflow_registrations(active_only=False, include_shared=True, with_workflow=False, limit=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_id OptionalNullable[str] The workflow ID to filter by
task_queue OptionalNullable[str] The task queue to filter by
active_only Optional[bool] Whether to only return active workflows versions
include_shared Optional[bool] Whether to include shared workflow versions
workflow_search OptionalNullable[str] The workflow name to filter by
archived OptionalNullable[bool] Filter by archived state. False=exclude archived, True=only archived, None=include all
with_workflow Optional[bool] Whether to include the workflow definition
available_in_chat_assistant OptionalNullable[bool] Whether to only return workflows compatible with chat assistant
limit Optional[int] The maximum number of workflows versions to return
cursor OptionalNullable[str] The cursor for pagination
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowRegistrationListResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

execute_workflow

Execute Workflow

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.execute_workflow(workflow_identifier="<value>", wait_for_result=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_identifier str ✔️ N/A
execution_id OptionalNullable[str] Allows you to specify a custom execution ID. If not provided, a random ID will be generated.
input OptionalNullable[Any] The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema.
encoded_input OptionalNullable[models.NetworkEncodedInput] Encoded input to the workflow, used when payload encoding is enabled.
wait_for_result Optional[bool] If true, wait for the workflow to complete and return the result directly.
timeout_seconds OptionalNullable[float] Maximum time to wait for completion when wait_for_result is true.
custom_tracing_attributes Dict[str, str] N/A
task_queue OptionalNullable[str] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use deployment_name instead.
deployment_name OptionalNullable[str] Name of the deployment to route this execution to
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ResponseExecuteWorkflowV1WorkflowsWorkflowIdentifierExecutePost

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

execute_workflow_registration

Execute Workflow Registration

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.execute_workflow_registration(workflow_registration_id="de11d76a-e0fb-44dd-abd9-2e75fc275b94", wait_for_result=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_registration_id str ✔️ N/A
execution_id OptionalNullable[str] Allows you to specify a custom execution ID. If not provided, a random ID will be generated.
input OptionalNullable[Any] The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema.
encoded_input OptionalNullable[models.NetworkEncodedInput] Encoded input to the workflow, used when payload encoding is enabled.
wait_for_result Optional[bool] If true, wait for the workflow to complete and return the result directly.
timeout_seconds OptionalNullable[float] Maximum time to wait for completion when wait_for_result is true.
custom_tracing_attributes Dict[str, str] N/A
task_queue OptionalNullable[str] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use deployment_name instead.
deployment_name OptionalNullable[str] Name of the deployment to route this execution to
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ResponseExecuteWorkflowRegistrationV1WorkflowsRegistrationsWorkflowRegistrationIDExecutePost

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_workflow

Get Workflow

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.get_workflow(workflow_identifier="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_identifier str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowGetResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

update_workflow

Update Workflow

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.update_workflow(workflow_identifier="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_identifier str ✔️ N/A
display_name OptionalNullable[str] New display name value
description OptionalNullable[str] New description value
available_in_chat_assistant OptionalNullable[bool] Whether to make the workflow available in the chat assistant
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowUpdateResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_workflow_registration

Get Workflow Registration

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.get_workflow_registration(workflow_registration_id="c4d86c40-960f-4e9a-9d6f-ad8342d7aa83", with_workflow=False, include_shared=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_registration_id str ✔️ N/A
with_workflow Optional[bool] Whether to include the workflow definition
include_shared Optional[bool] Whether to include shared workflow versions
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowRegistrationGetResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

archive_workflow

Archive Workflow

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.archive_workflow(workflow_identifier="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_identifier str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowArchiveResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

unarchive_workflow

Unarchive Workflow

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.workflows.unarchive_workflow(workflow_identifier="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_identifier str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowUnarchiveResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*