Skip to content

Commit 8dc45f0

Browse files
Merge pull request mendix#8852 from mendix/kv-GenAI
GenAI how-to
2 parents b6a01a5 + 994663c commit 8dc45f0

11 files changed

Lines changed: 362 additions & 7 deletions

File tree

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Mendix supports a variety of generative AI tasks by integrating with tools such
2525

2626
To start using the GenAI capabilities of Mendix, complete the following tasks:
2727

28-
1. Familiarize yourself with [concepts](/appstore/modules/genai/using-gen-ai/) such as prompt engineering, Retrieval Augmented Generation (RAG) and function calling (ReAct).
28+
1. Familiarize yourself with [concepts](/appstore/modules/genai/get-started/) such as prompt engineering, Retrieval Augmented Generation (RAG) and function calling (ReAct).
2929
2. Select the right architecture to support your use case. For a full list of possibilities, see [Architecture and Components](#architecture).
3030
3. Obtain the required credentials for your selected architecture.
3131

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/concepts/_index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Using Generative AI"
3-
url: /appstore/modules/genai/using-gen-ai/
4-
linktitle: "Using GenAI"
2+
title: "Get Started with Generative AI"
3+
url: /appstore/modules/genai/get-started/
4+
linktitle: "Get Started with GenAI"
55
weight: 10
66
description: "Describes the concepts behind generative AI and what you might implement with it."
77
---

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/concepts/prompt-engineering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ After telling the model what to do, you can include additional context. This can
7373

7474
* information about the end-user of your application – for example their language, role, department, specific database records
7575
* context information – for example, all data related to an object the end-user is looking at
76-
* knowledge coming from [Retrieval Augmented Generation (RAG)](/appstore/modules/genai/using-gen-ai/#rag)
76+
* knowledge coming from [Retrieval Augmented Generation (RAG)](/appstore/modules/genai/get-started/#rag)
7777

7878
Tip: you can provide information in a JSON or XML structure to ensure the information is presented in a consistent way. From Mendix apps, you can use [Export Mappings](/refguide/export-mappings/) to create JSON structures and [Export XML Documents](/howto/integration/export-xml-documents/) to create XML structures.
7979

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/concepts/rag-example-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: "Describes the retrieval augmented generation (RAG) pattern and the
1111

1212
Retrieval augmented generation (RAG) is a framework for an AI-based search using a private or external knowledge base that combines embeddings-based knowledge retrieval with a text generation model. The starting point is a collection of data to be considered as the private knowledge base. The final goal is that an end user of the app can ask questions about the data and the assistant's responses are only be based on this knowledge base.
1313

14-
{{% alert color="info" %}}This document describes how to set up RAG with PgVector. If you want to use the Bedrock Retrieval Augmented Generation capabilities, see [Bedrock Retrieval Augmented Generation](/appstore/modules/genai/using-gen-ai/#rag).{{% /alert %}}
14+
{{% alert color="info" %}}This document describes how to set up RAG with PgVector. If you want to use the Bedrock Retrieval Augmented Generation capabilities, see [Bedrock Retrieval Augmented Generation](/appstore/modules/genai/get-started/#rag).{{% /alert %}}
1515

1616
### Terminology
1717

content/en/docs/appstore/use-content/platform-supported-content/modules/genai/conversational-ui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Typical use cases for Conversational UI include the following:
1919
* Create a chat interface for users to chat with Large Language Models (LLM).
2020
* Allow users to switch between different implementations by switching providers.
2121
* Include advanced capabilities to control the model's behavior, for example, by setting the temperature parameter.
22-
* Easily extend the chat interface with advanced concepts, such as RAG or the ReAct pattern. For more information, see [Using Generative AI](/appstore/modules/genai/using-gen-ai/).
22+
* Easily extend the chat interface with advanced concepts, such as RAG or the ReAct pattern. For more information, see [Get Started with Generative AI](/appstore/modules/genai/get-started/).
2323

2424
### Features {#features}
2525

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "How to Build Smarter Apps Using GenAI"
3+
url: /appstore/modules/genai/using-genai/
4+
linktitle: "How to Build Smarter Apps using GenAI"
5+
weight: 10
6+
description: "Tutorial on how to get started with GenAI for Smarter Apps"
7+
no_list: false
8+
---
9+
10+
## Introduction
11+
12+
Generative Artificial Intelligence (GenAI) transforms business applications, empowering developers and technologists to create smarter, more dynamic solutions. This document provides the knowledge and tools needed to make your first GenAI-powered application and guides developers and business technologists in integrating GenAI into their Mendix applications.
13+
14+
## Key Resources to Continue Your GenAI Journey
15+
16+
### Support Resources
17+
18+
* The [GenAI Showcase App](https://marketplace.mendix.com/link/component/220475) demonstrates over 10 use cases for implementing GenAI.
19+
* The [Support Assistant Starter App](https://marketplace.mendix.com/link/component/231035) is a template that incorporates [**RAG (Retrieval-Augmented Generation)**](/appstore/modules/genai/rag/), [**function calling (ReAct Pattern)**](/appstore/modules/genai/function-calling/), and knowledge base integration. For more details on this use case, see [How to Build Smarter Apps with Function Calling & Generative AI](https://www.mendix.com/blog/building-smarter-apps-with-function-calling-and-generative-ai/).
20+
21+
### Prompt Engineering Resources
22+
23+
* The [Prompt Engineering](/appstore/modules/genai/prompt-engineering/) documentation provides an introduction to the basics of prompting and useful tips.
24+
* The [Prompt Library](https://mendixlabs.github.io/smart-apps-prompt-library/) offers a collection of prompts used in Mendix applications, as well as other examples.
25+
* The blog post [Hey ChatGPT, Write a Blog Post About Prompt Engineering – Part 1](https://www.mendix.com/blog/part-one-hey-chatgpt-can-you-write-me-a-blog-post-about-prompt-engineering/) introduces the fundamentals of prompt engineering, including techniques and examples.
26+
* The blog post [Hey ChatGPT, Write a Blog Post About Prompt Engineering – Part 2](https://www.mendix.com/blog/hey-chatgpt-can-you-write-me-a-blog-post-about-prompt-engineering-part-2/) explores the Tree of Thought (ToT) prompt technique, provides recommendations for getting started, and discusses how to handle hallucinations.
27+
28+
### Additional Resources
29+
30+
* Basic documentation on [Get Started with Generative AI](/appstore/modules/genai/get-started/) is an essential resource for anyone beginning their GenAI journey.
31+
* The [GenAI Commons](/appstore/modules/genai/commons/) and [Conversational UI](/appstore/modules/genai/conversational-ui/) modules offer a comprehensive overview of the technical aspects.
32+
* The [OpenAI](/appstore/modules/genai/openai/) provides essential information about the OpenAI connector.
33+
* The [Amazon Bedrock](/appstore/modules/aws/amazon-bedrock/) provides key information about the AWS Bedrock connector.
34+
* The [PGVector Knowledge Base](/appstore/modules/genai/pgvector/) offers the option for a private knowledge base outside of the LLM infrastructure.
35+
36+
For any additional feedback, send a message in the #genai-connectors channel on the Mendix Community slack. You can sign up for the Mendix Community [here](https://mendixcommunity.slack.com/join/shared_invite/zt-270ys3pwi-kgWhJUwWrKMEMuQln4bqrQ#/shared-invite/email).
37+
38+
## Documents in this Category
39+
40+
* [Build a Smart App using a Starter Template](/appstore/modules/genai/using-genai/starter-template/)
41+
* [Build a Smart App from a Blank GenAI App](/appstore/modules/genai/using-genai/blank-app/)
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: "Build a Chatbot Using the AI Bot Starter App"
3+
url: /appstore/modules/genai/using-genai/starter-template
4+
linktitle: "Build a Chatbot Using the AI Bot Starter App"
5+
weight: 10
6+
description: "A tutorial that describes how to get started building a smart app with a starter template"
7+
---
8+
9+
## Introduction
10+
11+
This document guides on building a smart app using a starter template. Alternatively, you can create your smart app from scratch using a blank GenAI app template. For more details, see [Build a Smart App from a Blank GenAI App](/appstore/modules/genai/using-genai/blank-app/).
12+
13+
### Prerequisites
14+
15+
Before starting this guide, make sure you have completed the following prerequisites:
16+
17+
* Intermediate knowledge of the Mendix platform: Familiarity with Mendix Studio Pro, microflows, and modules is required.
18+
19+
* Basic understanding of GenAI concepts: Review the [Enrich Your Mendix App with GenAI Capabilities](/appstore/modules/genai/) page to gain foundational knowledge and become familiar with the key [concepts](/appstore/modules/genai/get-started/).
20+
21+
* Understanding Large Language Models (LLMs) and Prompt Engineering: Learn about [LLMs](/appstore/modules/genai/get-started/#llm) and [prompt engineering](/appstore/modules/genai/get-started/#prompt-engineering) to effectively use these within the Mendix ecosystem.
22+
23+
### Learning Goals
24+
25+
By the end of this document, you will:
26+
27+
* Understand the core concepts of Generative AI and its integration with the Mendix platform.
28+
29+
* Build your first augmented Mendix application using GenAI starter apps and connectors.
30+
31+
* Develop a solid foundation for leveraging GenAI capabilities to address common business use cases.
32+
33+
## Building Your Smart App with a Starter Template
34+
35+
To simplify your first use case, start building a chatbot using the [AI Bot Starter App](https://marketplace.mendix.com/link/component/227926). This pre-built template streamlines the process, allowing you to quickly integrate AI capabilities into your application. You can see the result in the image below.
36+
37+
{{< figure src="/attachments/appstore/platform-supported-content/modules/genai/genai-howto-starterapp/starter_genai_interface.jpg" >}}
38+
39+
### Choosing the Infrastructure
40+
41+
Selecting the infrastructure for integrating GenAI into your Mendix application is the first step. Depending on your use case and preferences, you can choose from the following options:
42+
43+
* [OpenAI](/appstore/modules/genai/openai/): The [OpenAI Connector](https://marketplace.mendix.com/link/component/220472?_gl=1*1gbywo4*_gcl_au*NjUwMzI0NzA0LjE3MzI2MjkxMTI.) supports OpenAI’s platform and Azure’s OpenAI service.
44+
45+
{{% alert color="info" %}}
46+
To start, you can sign up for a free trial with OpenAI and receive credits valid for three months from the account creation date. For more details, see the [OpenAI API reference](https://platform.openai.com/docs/api-reference/authentication).
47+
{{% /alert %}}
48+
49+
* [Amazon Bedrock](/appstore/modules/genai/bedrock/): The [Bedrock Connector](https://marketplace.mendix.com/link/component/215042?_gl=1*yogwo1*_gcl_au*NjUwMzI0NzA0LjE3MzI2MjkxMTI.) allows you to leverage Amazon Bedrock’s fully managed service to integrate foundation models from Amazon and leading AI providers.
50+
51+
* Your Own Connector: Optionally, if you prefer a custom connector, you can integrate your chosen infrastructure. However, this document focuses on the OpenAI and Bedrock connectors, as they offer comprehensive support and ease of use to get started.
52+
53+
### Getting Started
54+
55+
Download the [AI Bot Starter App](https://marketplace.mendix.com/link/component/227926) from the Marketplace and configure the **encryption key** in the **App Settings**. Follow the steps below based on the infrastructure you chose.
56+
57+
#### OpenAI Configuration
58+
59+
Follow the steps below to configure OpenAI for your application. For more information, see the [Configuration](/appstore/modules/genai/openai/#configuration) section of the *OpenAI*.
60+
61+
1. Run the application locally.
62+
63+
2. Configure OpenAI Settings:
64+
65+
* In the chatbot-like application interface, go to the **Settings** ({{% icon name="cog" %}}) icon, and find the **OpenAI Configuration**.
66+
* Click **New** and provide the following details:
67+
* **Display Name**: A reference name to identify this configuration (for example, "My OpenAI Configuration").
68+
* **API Type**: Choose between **OpenAI** or **Azure OpenAI**.
69+
* **Endpoint**: Enter the endpoint URL for your selected API type.
70+
* **Token**: Provide the API key for authentication.
71+
* If using Azure OpenAI, add:
72+
* **Deployment Name**: Specify the deployed model (for example, *gpt-4o*, *gpt-3.5-turbo*, etc.)
73+
* **API Version**: Provide the version of the API you are using (for example, *2024-06-01*, *2024-10-21*, etc.)
74+
75+
* Click **Save** to store your configuration.
76+
77+
3. Test the Configuration:
78+
79+
* Select the configuration you created, and click **Test Configuration**.
80+
* If an error occurs, check the **Mendix Console** for more details on resolving the issue.
81+
82+
#### Bedrock Configuration
83+
84+
Follow the steps below to configure Amazon Bedrock for your application:
85+
86+
1. Set Up AWS credentials:
87+
88+
* Navigate to **App Settings** > **Configurations** in Studio Pro.
89+
* Go to the **Constants** tab and add the following (In this example, static credentials are used. For more details on the temporary credentials, see the [Implementing Temporary Credentials](/appstore/modules/aws/aws-authentication/#session) section of the *AWS Authentication*).
90+
91+
* `AWSAuthentication.AccessKey`: Enter the access key obtained from the Amazon Bedrock console.
92+
* `AWSAuthentication.SecretAccessKey`: Enter the secret access key from the Amazon Bedrock console.
93+
94+
* Save your changes.
95+
96+
2. Run the application locally.
97+
98+
3. Configure Bedrock settings:
99+
100+
* In the chatbot-like application interface, go to **Administration** > **Amazon Bedrock Configuration**.
101+
* Click **New/Edit** and provide the following details:
102+
* **Region**: Select the AWS region where your Bedrock service is hosted.
103+
* **Use Static Credentials**: Enable this option if you are using static AWS credentials configured in the app.
104+
* Click **Save & Sync Data** to ensure your changes are applied.
105+
106+
### Bot Configuration
107+
108+
Before starting the bot configuration, ensure that the OpenAI or Bedrock configuration is complete.
109+
110+
1. In the **Administration** menu, go to the **Bot Configuration**, and click **New**.
111+
2. Enter the following details:
112+
113+
* **Display Name**: A reference name for the bot configuration (for example, "Configuration Bot").
114+
* **Architecture**: Select **OpenAI** or **Bedrock** based on your choice.
115+
* **Is Selectable in UI**: Enable this option to allow the end user to select this configuration.
116+
* **Configuration**: Select the OpenAI or Bedrock configuration you just created.
117+
* **Action Microflow**: Choose the provided microflow, `ChatContext_ChatWithHistory_ActionMicroflow`.
118+
119+
3. Save your changes, and optionally set it as the default bot configuration by selecting **Make Default** on the Bot Configuration page.
120+
121+
## Testing and Troubleshooting
122+
123+
Follow the steps below to test the chatbot:
124+
125+
1. Navigate to the **Chat** option in the top menu to open the chatbot interface.
126+
2. In the **Configuration** box:
127+
* Select your bot configuration.
128+
* Optionally, choose instructions for the LLM to follow.
129+
3. Start interacting with your chatbot by typing in the chat box.
130+
4. For additional testing, create a custom instruction for the LLM, such as: 'You are a travel advisor assistant. Your role is to provide travel tips and destination information.'
131+
132+
Congratulations! Your chatbot is now ready to use.
133+
134+
If an error occurs, check the **Mendix Console** in Studio Pro for details to help resolve the issue.

0 commit comments

Comments
 (0)