--- alias: user-guide-gen-ai-index --- # GenAI :lock: Product.GenAI.**AskAI** :lock: Product.GenAI.**ViewSummary** :lock: Resource.GenAI.**AskAI** :lock: Resource.GenAI.**ViewSummary** ## Overview **GenAI** provides generative AI capabilities inside the MES. It allows you to ask questions about the content of entity documents and attachments or quickly generate summaries. GenAI is currently available for **Products** and **Resources**. ## Preconditions * The **Generative AI Infrastructure** must be deployed and configured in your MES environment. !!! info To deploy the Generative AI Infrastructure, follow the steps in the [[installation-guide-installation#package-configuration]] guide. * A valid email address must be configured for your user. * The **Attachment Types** that can be processed by the LLM are configured. ## Configuration ### Add an Email Address 1. Go to **Administration > Security > Users**. 2. Select the user you want to grant access to **GenAI**. 3. Verify that the **Email Address** field is defined. ### Enable Generative AI for Attachments To allow **GenAI** to process specific attachment types: 1. Go to **Administration > Tables > Generic Tables**. 2. Open the [[attachmenttype-gt]] Generic Table. 3. Enable the column **Enable Generative AI** for each Entity Type and Attachment Type you want **GenAI** to use. ## Using the GenAI Features **GenAI** can be accessed directly from entity pages. Two buttons are available: * **Ask AI** – this button allows you to ask questions about the content of documents and attachments. * **View Summary** – this button allows you to generate a summary of a selected document or attachment, with the option to ask follow-up questions. You can open the **GenAI** panel in three different ways: 1. From the **entity toolbar**, by selecting **Ask AI**. ![GenAI button in the entity toolbar](../images/gen_ai_entity_toolbar.png) 2. From the **View Documents** window, using the drop-down menu (**Ask AI** or **View Summary**). ![GenAI options in the View Documents window](../images/gen_ai_in_view_documents.png) 3. From the **Attachments** section: * If you select one document, both **Ask AI** and **View Summary** are available on the toolbar. * If you select multiple documents, only **Ask AI** is available. * If you open a single document, the drop-down menu provides both **Ask AI** and **View Summary**. === "Selecting One Attachment" ![GenAI options when one attachment is selected](../images/gen_ai_one_attachment.png) === "Selecting Multiple Attachments" ![GenAI options when multiple attachments are selected](../images/gen_ai_multiple_attachments.png) ## LLM Prompts When you open the **GenAI** panel, a context prompt is sent to the LLM. This context contains: * The entity ID and type. * The IDs of selected documents and/or attachments. * The instructions required to generate the correct answer. * An optional initial prompt, if configured. This context can be customized by: * Entity type * Button location (Entity, Documents, and Attachments) * Button type (Ask AI and View Summary) To customize the LLM prompt: 1. Go to **Administration > Tables > Smart Tables**. 2. Open the [[generativeaiprompt-st]] Smart Table. 3. Create or edit an entry and define the following fields as required: * **Entity Type** – optionally, specify the entity where the customization applies. * **Prompt Id** – choose the unique identifier for the prompt configuration. * **Agent Id** – optionally, identify of the agent to be used. * **MCP Server Ids** – optionally, choose the MCP servers unique identifier for the configuration. !!! info If multiple MCP Server Ids are defined, the system automatically selects the appropriate one. A fresh MES installation includes the following MCP Server Ids: `mes`, `cubes`, and `cdm`. * **Model** – optionally, set the LLM model to be used. * **Temperature** – optionally, set the randomness of the LLM output (lower values produce more deterministic answers). * **Prompt Prefix** – define the context text sent to the LLM before the user input. * **First Prompt** – optionally, define the initial instruction or question automatically added when the panel opens. !!! warning The prompt prefix and the first prompt are included in the URL and cannot exceed 2000 characters each. ![Editing the Generative AI prompt in the Smart Table](../images/edit_generative_ai_prompt.png)