Skip to content

Latest commit

 

History

History
547 lines (368 loc) · 35.4 KB

File metadata and controls

547 lines (368 loc) · 35.4 KB

Beta.Observability.Evaluations

Overview

Available Operations

create_pipeline_config

Create a worker pipeline configuration

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.create_pipeline_config(name="<value>", pipeline_kind="judge", selectors=[], definition={
        "slug": "<value>",
    }, enabled=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
name str ✔️ N/A
pipeline_kind models.PipelineKind ✔️ N/A
selectors List[models.PipelineConfigSelector] ✔️ N/A
definition models.PipelineConfigDefinition ✔️ N/A
description OptionalNullable[str] ➖ N/A
enabled Optional[bool] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PipelineConfig

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

list_pipeline_configs

List worker pipeline configurations

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.list_pipeline_configs(page_size=50, page=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
pipeline_kind OptionalNullable[models.PipelineKind] ➖ N/A
enabled OptionalNullable[bool] ➖ N/A
page_size Optional[int] ➖ N/A
page Optional[int] ➖ N/A
q OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PipelineConfigsResponse

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

get_pipeline_config

Get a worker pipeline configuration

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.get_pipeline_config(pipeline_config_id="939fdf7d-2edf-45ca-bb75-a47326da1799")

    # Handle response
    print(res)

Parameters

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

Response

models.PipelineConfig

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

update_pipeline_config

Replace a worker pipeline configuration

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.update_pipeline_config(pipeline_config_id="4ee75abd-cccd-4232-9858-0c535465bfd5", name="<value>", pipeline_kind="detection", selectors=[], definition={
        "target_attributes": [
            "<value 1>",
        ],
        "patterns": [
            {
                "name": "<value>",
                "regex": "<value>",
                "category": "<value>",
                "confidence": "<value>",
            },
        ],
    }, enabled=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
pipeline_config_id str ✔️ N/A
name str ✔️ N/A
pipeline_kind models.PipelineKind ✔️ N/A
selectors List[models.PipelineConfigSelector] ✔️ N/A
definition models.PipelineConfigDefinition ✔️ N/A
enabled bool ✔️ N/A
description OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PipelineConfig

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

delete_pipeline_config

Delete a worker pipeline configuration

Example Usage

from mistralai.client import Mistral
import os


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

    mistral.beta.observability.evaluations.delete_pipeline_config(pipeline_config_id="816cdd49-f7b2-4941-a73d-af3c25958c4d")

    # Use the SDK ...

Parameters

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

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

create_pipeline

Create a pipeline

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.create_pipeline(name="<value>", selectors=[], definitions=[
        {
            "slug": "<value>",
        },
    ], enabled=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
name str ✔️ N/A
selectors List[models.PipelineConfigSelector] ✔️ N/A
definitions List[models.JudgeDefinition] ✔️ N/A
description OptionalNullable[str] ➖ N/A
enabled Optional[bool] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Pipeline

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

list_pipelines

List pipelines

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.list_pipelines(page_size=50, page=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
enabled OptionalNullable[bool] ➖ N/A
page_size Optional[int] ➖ N/A
page Optional[int] ➖ N/A
q OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PipelinesResponse

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

get_pipeline

Get a pipeline

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.get_pipeline(pipeline_id="aafed470-377a-4e11-85ec-e5de5b40c79f")

    # Handle response
    print(res)

Parameters

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

Response

models.Pipeline

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

update_pipeline

Update a pipeline

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.update_pipeline(pipeline_id="2c18966b-8d2d-41fb-a02c-9a9bf9df2919")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
pipeline_id str ✔️ N/A
name Optional[str] ➖ N/A
description OptionalNullable[str] ➖ N/A
selectors List[models.PipelineConfigSelector] ➖ N/A
definitions List[models.JudgeDefinition] ➖ N/A
enabled Optional[bool] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Pipeline

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

delete_pipeline

Delete a pipeline

Example Usage

from mistralai.client import Mistral
import os


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

    mistral.beta.observability.evaluations.delete_pipeline(pipeline_id="eb888b07-60a4-490b-9515-f6b32ee11ccf")

    # Use the SDK ...

Parameters

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

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

list

List evaluations for a project

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.list(project_slug="<value>", page_size=50, page=1)

    # Handle response
    print(res)

Parameters

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

Response

models.EvaluationsV2

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*

get

Get evaluation by slug

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.evaluations.get(evaluation_slug="<value>")

    # Handle response
    print(res)

Parameters

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

Response

models.EvaluationV2

Errors

Error Type Status Code Content Type
errors.ObservabilityError 400, 404, 408, 409, 422 application/json
errors.SDKError 4XX, 5XX */*