# Classifiers ## Overview Classifiers API. ### Available Operations * [moderate](#moderate) - Moderations * [moderate_chat](#moderate_chat) - Chat Moderations * [classify](#classify) - Classifications * [classify_chat](#classify_chat) - Chat Classifications ## moderate Moderations ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.classifiers.moderate(model="mistral-moderation-latest", inputs="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `model` | *str* | :heavy_check_mark: | ID of the model to use. | mistral-moderation-latest | | `inputs` | [models.ClassificationRequestInputs](../../models/classificationrequestinputs.md) | :heavy_check_mark: | Text to classify. | | | `metadata` | Dict[str, *Any*] | :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.ModerationResponse](../../models/moderationresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## moderate_chat Chat Moderations ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.classifiers.moderate_chat(inputs=[ { "role": "tool", "content": "", }, ], model="LeBaron") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | | `inputs` | [models.ChatModerationRequestInputs3](../../models/chatmoderationrequestinputs3.md) | :heavy_check_mark: | Chat to classify | | `model` | *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.ModerationResponse](../../models/moderationresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## classify Classifications ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.classifiers.classify(model="mistral-moderation-latest", inputs=[ "", ]) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `model` | *str* | :heavy_check_mark: | ID of the model to use. | mistral-moderation-latest | | `inputs` | [models.ClassificationRequestInputs](../../models/classificationrequestinputs.md) | :heavy_check_mark: | Text to classify. | | | `metadata` | Dict[str, *Any*] | :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.ClassificationResponse](../../models/classificationresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## classify_chat Chat Classifications ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.classifiers.classify_chat(model="Camry", input=[ { "messages": [ { "role": "system", "content": "", }, ], }, ]) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `model` | *str* | :heavy_check_mark: | N/A | | `input` | [models.Inputs](../../models/inputs.md) | :heavy_check_mark: | Chat to classify | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.ClassificationResponse](../../models/classificationresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* |