# Watermarking ## Overview ### Available Operations * [detect](#detect) - Detections * [detect_multipart](#detect_multipart) - Detections ## detect Detect whether content was produced with a Mistral watermark. Accepts exactly one input: a JSON body (``{"text": ...}``) for text, or a multipart ``file`` upload. Returns the watermark-detector verdict (``watermarked`` + ``watermarked_reason``) and the content-metadata verdict (``metadata_valid`` + ``metadata_reason``) separately; each flag is ``"true"`` / ``"false"`` / ``null`` (null = not tested, see the matching ``*_reason``). ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY"), ) as mistral: res = mistral.watermarking.detect(text="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `text` | *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.DetectionResponse](../../models/detectionresponse.md)** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## detect_multipart Detect whether content was produced with a Mistral watermark. Accepts exactly one input: a JSON body (``{"text": ...}``) for text, or a multipart ``file`` upload. Returns the watermark-detector verdict (``watermarked`` + ``watermarked_reason``) and the content-metadata verdict (``metadata_valid`` + ``metadata_reason``) separately; each flag is ``"true"`` / ``"false"`` / ``null`` (null = not tested, see the matching ``*_reason``). ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY"), ) as mistral: res = mistral.watermarking.detect_multipart(file={ "file_name": "example.file", "content": open("example.file", "rb"), }) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `file` | [models.File](../../models/file.md) | :heavy_check_mark: | The File object (not file name) to be uploaded.
To upload a file and specify a custom file name you should format your request as such:
```bash
file=@path/to/your/file.jsonl;filename=custom_name.jsonl
```
Otherwise, you can just keep the original file name:
```bash
file=@path/to/your/file.jsonl
``` | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.DetectionResponse](../../models/detectionresponse.md)** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |