> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.loaders.mistral reader

<a id="camel.loaders.mistral_reader" />

<a id="camel.loaders.mistral_reader.MistralReader" />

## MistralReader

```python theme={"system"}
class MistralReader:
```

Mistral Document Loader.

<a id="camel.loaders.mistral_reader.MistralReader.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    api_key: Optional[str] = None,
    model: Optional[str] = 'mistral-ocr-latest'
):
```

Initialize the MistralReader.

**Parameters:**

* **api\_key** (Optional\[str]): The API key for the Mistral API. (default: :obj:`None`)
* **model** (Optional\[str]): The model to use for OCR. (default: :obj:`"mistral-ocr-latest"`)

<a id="camel.loaders.mistral_reader.MistralReader._encode_file" />

### \_encode\_file

```python theme={"system"}
def _encode_file(self, file_path: str):
```

Encode the pdf to base64.

**Parameters:**

* **file\_path** (str): Path to the input file.

**Returns:**

str: base64 version of the file.

<a id="camel.loaders.mistral_reader.MistralReader.extract_text" />

### extract\_text

```python theme={"system"}
def extract_text(
    self,
    file_path: str,
    is_image: bool = False,
    pages: Optional[List[int]] = None,
    include_image_base64: Optional[bool] = None
):
```

Converts the given file to Markdown format.

**Parameters:**

* **file\_path** (str): Path to the input file or a remote URL.
* **is\_image** (bool): Whether the file or URL is an image. If True, uses image\_url type instead of document\_url. (default: :obj:`False`)
* **pages** (Optional\[List\[int]]): Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0. (default: :obj:`None`)
* **include\_image\_base64** (Optional\[bool]): Whether to include image URLs in response. (default: :obj:`None`)

**Returns:**

OCRResponse: page wise extractions.
