Skip to content

Latest commit

 

History

History
183 lines (120 loc) · 10.1 KB

README.md

File metadata and controls

183 lines (120 loc) · 10.1 KB

MistralJobs

(batch.jobs)

Overview

Available Operations

  • list - Get Batch Jobs
  • create - Create Batch Job
  • get - Get Batch Job
  • cancel - Cancel Batch Job

list

Get a list of batch jobs for your organization and user.

Example Usage

from mistralai import Mistral
import os

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

    res = mistral.batch.jobs.list()

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
page Optional[int] N/A
page_size Optional[int] N/A
model OptionalNullable[str] N/A
metadata Dict[str, Any] N/A
created_after date N/A
created_by_me Optional[bool] N/A
status OptionalNullable[models.BatchJobStatus] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.BatchJobsOut

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

create

Create a new batch job, it will be queued for processing.

Example Usage

from mistralai import Mistral
import os

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

    res = mistral.batch.jobs.create(input_files=[
        "a621cf02-1cd9-4cf5-8403-315211a509a3",
    ], endpoint="/v1/fim/completions", model="2")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
input_files List[str] ✔️ N/A
endpoint models.APIEndpoint ✔️ N/A
model str ✔️ N/A
metadata Dict[str, str] N/A
timeout_hours Optional[int] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.BatchJobOut

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

get

Get a batch job details by its UUID.

Example Usage

from mistralai import Mistral
import os

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

    res = mistral.batch.jobs.get(job_id="b888f774-3e7c-4135-a18c-6b985523c4bc")

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

models.BatchJobOut

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

cancel

Request the cancellation of a batch job.

Example Usage

from mistralai import Mistral
import os

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

    res = mistral.batch.jobs.cancel(job_id="0f713502-9233-41c6-9ebd-c570b7edb496")

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

models.BatchJobOut

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*