# Beta.Observability.Traces ## Overview ### Available Operations * [search](#search) - Search traces * [aggregate](#aggregate) - Aggregate traces * [get_trace_fields](#get_trace_fields) - Get trace field definitions * [get_trace_by_id](#get_trace_by_id) - Get trace by id * [get_trace_spans](#get_trace_spans) - Get trace spans * [fetch_options](#fetch_options) - Get options for a trace field * [get_span_by_id](#get_span_by_id) - Get span by id ## search Search traces ### Example Usage ```python 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](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `to` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `page_size` | *Optional[int]* | :heavy_minus_sign: | N/A | | `cursor` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `search_expression` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetTraces](../../models/gettraces.md)** ### 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 ```python 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": "", "aggregation": "p95", }, limit=1000) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `metric` | [models.MetricDefinition](../../models/metricdefinition.md) | :heavy_check_mark: | N/A | | `from_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `to` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `dimensions` | List[*str*] | :heavy_minus_sign: | N/A | | `time_dimension` | [OptionalNullable[models.TimeDimension]](../../models/timedimension.md) | :heavy_minus_sign: | N/A | | `search_expression` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `order_by` | List[[models.OrderByClause](../../models/orderbyclause.md)] | :heavy_minus_sign: | N/A | | `limit` | *Optional[int]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.Aggregation](../../models/aggregation.md)** ### 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 ```python 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]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetTraceFields](../../models/gettracefields.md)** ### 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 ```python 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="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `trace_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetTrace](../../models/gettrace.md)** ### 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 ```python 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="", page_size=50) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | | `trace_id` | *str* | :heavy_check_mark: | N/A | | `from_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `to` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `page_size` | *Optional[int]* | :heavy_minus_sign: | N/A | | `cursor` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetSpans](../../models/getspans.md)** ### 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 ```python 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="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | | `field_name` | *str* | :heavy_check_mark: | N/A | | `from_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `to` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetTraceFieldOptions](../../models/gettracefieldoptions.md)** ### 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 ```python 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="", span_id="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | | `trace_id` | *str* | :heavy_check_mark: | N/A | | `span_id` | *str* | :heavy_check_mark: | N/A | | `from_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `to` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.GetSpan](../../models/getspan.md)** ### Errors | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | errors.ObservabilityError | 400, 404, 408, 409, 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* |