# MistralAI

<figure><img src="https://3864624312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdo1pkMnofwxf3lpWftw%2Fuploads%2F4icKKnXhvkuk5MtiOAkf%2Fimage.png?alt=media&#x26;token=c5fc6e1d-589f-44c4-b9c7-47d69a501d8c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3864624312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdo1pkMnofwxf3lpWftw%2Fuploads%2FDpqq8g1qNpYd595aKsf6%2Fimage.png?alt=media&#x26;token=dd0187b5-87e9-4d5f-9327-0fc9f98da0a2" alt=""><figcaption></figcaption></figure>

## Description

The MistralAI model, developed by Mistral AI SAS, is a language model that combines the power of GPT (Generative Pre-trained Transformer) with LLM (Language Model for Legal Text). It is specifically designed to understand and generate legal text, making it useful for tasks such as legal document analysis, contract generation, and legal research. The model has been trained on a large corpus of legal documents to ensure accuracy and relevance in its responses.

The MistralAI component allows you to integrate MistralAI into your flows. You can customize the parameters used by MistralAI component, and also specify the context of knowledge that the MistralAI component operates on, as well as provide the input query. Both the context and the query are given to the MistralAI component by specifying Diaflow component identifiers. For example, the above screenshot shows the default user message of **trigger.text** which is a Text Input component.&#x20;

The MistralAI component has the identifier of an-**X**, where **X** represents the instance number of the MistralAI component.

## Inputs

The MistralAI component has the following input connections.

| Input Name                               | Description                                                                      | Constraints                                                                                                      |
| ---------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| From data Loaders/ Data source/Vector DB | This input connection represents the context information for the MistralAI model | Must originate from a Data Loader/Data Source or VectorDB component.                                             |
| From Input                               | This input connection represents the user query for the MistralAI model.         | Must originate from a component that generates a text string as output such as a Python or Text Input component. |

## Component settings

| Parameter Name | Description                                                                                                                                                                                                                                             |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Model          | <p>This parameter specifies the version of MistralAI that the component should use. </p><p><br>Available values:</p><ul><li>Mistral 7B</li><li>Mixtral 8x7B</li><li>Mistral Small (24.02)</li><li>Mistral Large (24.02)</li><li>Pixtral Large</li></ul> |
| Prompt         | Describes how you want the MistralAI model to respond. For example, you can specify the role, manner and rules that MistralAI should adhere to. Also mention the component ID to connect the components.                                                |
| Image source   | Adding an image to your prompt by identify a trigger file in this configuration.                                                                                                                                                                        |

## Advanced configurations

| Options        | Description                                                                                                                                                                                                               |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enable caching | This option determines whether the results of the component are cached. This means that on the next run of the Flow, Diaflow will utilize the previous computed component output, as long as the inputs have not changed. |
| Caching time   | <p>Only applicable if the "Enable Caching" option has been enabled.<br>This parameter controls how long Diaflow will wait before automatically clearing the cache.</p>                                                    |

## Outputs

The MistralAI component has the following output connections.

| Output Name | Description                                                                 | Constraints                                                    |
| ----------- | --------------------------------------------------------------------------- | -------------------------------------------------------------- |
| To Output   | This output connection contains the text result of the MistralAI component. | Can be connected to any component that accepts a string input. |

## Use case

Here is a simple use case of the MistralAI component, where the MistralAI component is being used to provide the user the ability to ask the MistralAI component questions via a Text Input component.

<figure><img src="https://3864624312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdo1pkMnofwxf3lpWftw%2Fuploads%2FQs0HYiwf3surdLvVwQaz%2Fimage.png?alt=media&#x26;token=04521397-267b-4157-a252-2efcc5349e1c" alt=""><figcaption></figcaption></figure>
