Skip to content

Latest commit

 

History

History
322 lines (214 loc) · 20.1 KB

File metadata and controls

322 lines (214 loc) · 20.1 KB

Beta.Observability.Traces

Overview

Available Operations

search

Search traces

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.traces.search(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.GetTraces

Errors

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

aggregate

Aggregate traces

Example Usage

from mistralai.client import Mistral
import os


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

    res = mistral.beta.observability.traces.aggregate(metric={
        "measure": "<value>",
        "aggregation": "p95",
    }, 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 */*

get_trace_fields

Get trace 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.traces.get_trace_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.GetTraceFields

Errors

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

get_trace_by_id

Get trace 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.traces.get_trace_by_id(trace_id="<id>")

    # Handle response
    print(res)

Parameters

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

Response

models.GetTrace

Errors

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

get_trace_spans

Get trace 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.traces.get_trace_spans(trace_id="<id>", page_size=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
trace_id str ✔️ N/A
from_ date N/A
to date N/A
page_size Optional[int] N/A
cursor 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 */*

fetch_options

Get options for a trace 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.traces.fetch_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.GetTraceFieldOptions

Errors

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

get_span_by_id

Get span 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.traces.get_span_by_id(trace_id="<id>", span_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
trace_id str ✔️ N/A
span_id 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.GetSpan

Errors

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