Skip to content

Latest commit

 

History

History
244 lines (166 loc) · 13.1 KB

File metadata and controls

244 lines (166 loc) · 13.1 KB

Beta.Observability.ChatCompletionEvents

Overview

Available Operations

  • search - Get Chat Completion Events
  • search_ids - Alternative to /search that returns only the IDs and that can return many IDs at once
  • fetch - Get Chat Completion Event
  • fetch_similar_events - Get Similar Chat Completion Events
  • judge - Run Judge on an event based on the given options

search

Get Chat Completion Events

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.chat_completion_events.search(search_params={
        "filters": None,
    }, page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
search_params models.FilterPayload ✔️ N/A
page_size Optional[int] N/A
cursor OptionalNullable[str] N/A
extra_fields List[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SearchChatCompletionEventsResponse

Errors

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

search_ids

Alternative to /search that returns only the IDs and that can return many IDs at once

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.chat_completion_events.search_ids(search_params={
        "filters": {
            "field": "<value>",
            "op": "lt",
            "value": "<value>",
        },
    })

    # Handle response
    print(res)

Parameters

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

Response

models.SearchChatCompletionEventIdsResponse

Errors

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

fetch

Get Chat Completion Event

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.chat_completion_events.fetch(event_id="e79bf81b-b37f-425e-9dff-071a54592e44")

    # Handle response
    print(res)

Parameters

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

Response

models.ChatCompletionEvent

Errors

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

fetch_similar_events

Get Similar Chat Completion Events

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.chat_completion_events.fetch_similar_events(event_id="b7be6e08-d068-45fc-b77a-966232e92fd6")

    # Handle response
    print(res)

Parameters

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

Response

models.SearchChatCompletionEventsResponse

Errors

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

judge

Run Judge on an event based on the given options

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.chat_completion_events.judge(event_id="dfcd5582-1373-4de5-af51-987464da561c", judge_definition={
        "name": "<value>",
        "description": "total plain self-confidence candid hungrily partial astride cruelly brr",
        "model_name": "<value>",
        "output": {
            "type": "CLASSIFICATION",
            "options": [
                {
                    "value": "<value>",
                    "description": "indeed insolence delightfully following",
                },
            ],
        },
        "instructions": "<value>",
        "tools": [],
    })

    # Handle response
    print(res)

Parameters

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

Response

models.JudgeOutput

Errors

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