Skip to content

Latest commit

 

History

History
509 lines (341 loc) · 33.4 KB

README.md

File metadata and controls

509 lines (341 loc) · 33.4 KB

Beta.Observability.Spans

Overview

Available Operations

search_spans

Search spans

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.search_spans(page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
from_ date ➖ N/A
to date ➖ N/A
page_size Optional[int] ➖ N/A
cursor OptionalNullable[str] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetSpans

Errors

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

aggregate

Aggregate spans

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.aggregate(metric={
        "measure": "<value>",
        "aggregation": "p99",
    }, limit=1000)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
metric models.MetricDefinition ✔️ N/A
from_ date ➖ N/A
to date ➖ N/A
dimensions List[str] ➖ N/A
time_dimension OptionalNullable[models.TimeDimension] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
order_by List[models.OrderByClause] ➖ N/A
limit Optional[int] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Aggregation

Errors

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

aggregate_span_evaluations

Aggregate span evaluations

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.aggregate_span_evaluations(metric={
        "measure": "<value>",
        "aggregation": "max",
    }, limit=1000)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
metric models.MetricDefinition ✔️ N/A
from_ date ➖ N/A
to date ➖ N/A
dimensions List[str] ➖ N/A
time_dimension OptionalNullable[models.TimeDimension] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
order_by List[models.OrderByClause] ➖ N/A
limit Optional[int] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Aggregation

Errors

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

search_span_evaluations

Search span evaluations

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.search_span_evaluations(page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
from_ date ➖ N/A
to date ➖ N/A
page_size Optional[int] ➖ N/A
cursor OptionalNullable[str] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetSpanEvaluations

Errors

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

search_latest_span_evaluations

Search latest span evaluations

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.search_latest_span_evaluations(page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
from_ date ➖ N/A
to date ➖ N/A
page_size Optional[int] ➖ N/A
cursor OptionalNullable[str] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetSpanEvaluations

Errors

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

search_pipeline_results

Search pipeline results

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.search_pipeline_results(pipeline_config_slugs=[
        "<value 1>",
    ], page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
pipeline_config_slugs List[str] ✔️ N/A
from_ date ➖ N/A
to date ➖ N/A
page_size Optional[int] ➖ N/A
cursor OptionalNullable[str] ➖ N/A
search_expression OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetPipelineResults

Errors

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

list_pipeline_result_fields

Get pipeline result field definitions

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.list_pipeline_result_fields(pipeline_id="c02f0afc-c7d2-483f-9977-c21cacf90d8d")

    # 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.GetPipelineResultFields

Errors

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

list_span_fields

Get span field definitions

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.list_span_fields()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetSpanFields

Errors

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

list_span_eval_fields

Get span evaluation field definitions

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.list_span_eval_fields()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetSpanEvaluationFields

Errors

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

fetch_span_field_options

Get options for a span field

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.fetch_span_field_options(field_name="<value>")

    # Handle response
    print(res)

Parameters

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

Response

models.GetSpanFieldOptions

Errors

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

fetch_span_eval_field_options

Get options for a span evaluation field

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.spans.fetch_span_eval_field_options(field_name="<value>")

    # Handle response
    print(res)

Parameters

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

Response

models.GetSpanEvaluationFieldOptions

Errors

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