Skip to content

Latest commit

 

History

History
267 lines (176 loc) · 15.1 KB

File metadata and controls

267 lines (176 loc) · 15.1 KB

Beta.Observability.Campaigns

Overview

Available Operations

  • create - Create and start a new campaign
  • list - Get all campaigns
  • fetch - Get campaign by id
  • delete - Delete a campaign
  • fetch_status - Get campaign status by campaign id
  • list_events - Get event ids that were selected by the given campaign

create

Create and start a new campaign

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.campaigns.create(search_params={
        "filters": {
            "field": "<value>",
            "op": "lt",
            "value": "<value>",
        },
    }, judge_id="9b501b9f-3525-44a7-a51a-5352679be9ed", name="<value>", description="shakily triangular scotch requirement whether once oh", max_nb_events=232889)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
search_params models.FilterPayload ✔️ N/A
judge_id str ✔️ N/A
name str ✔️ N/A
description str ✔️ N/A
max_nb_events int ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Campaign

Errors

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

list

Get all campaigns

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.campaigns.list(page_size=50, page=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
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.ListCampaignsResponse

Errors

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

fetch

Get campaign by id

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.campaigns.fetch(campaign_id="fd7945d6-00e2-4852-9054-bcbb968d7f98")

    # Handle response
    print(res)

Parameters

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

Response

models.Campaign

Errors

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

delete

Delete a campaign

Example Usage

from mistralai.client import Mistral
import os


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

    mistral.beta.observability.campaigns.delete(campaign_id="90e07b45-8cf7-4081-8558-a786779e039d")

    # Use the SDK ...

Parameters

Parameter Type Required Description
campaign_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 */*

fetch_status

Get campaign status by campaign id

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.campaigns.fetch_status(campaign_id="4b1dd9a5-8dc9-48e1-bd11-29443e959902")

    # Handle response
    print(res)

Parameters

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

Response

models.FetchCampaignStatusResponse

Errors

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

list_events

Get event ids that were selected by the given campaign

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.campaigns.list_events(campaign_id="305b5e46-a650-4d8a-8b5b-d23ef90ec831", page_size=50, page=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
campaign_id 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.ListCampaignSelectedEventsResponse

Errors

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