AI for Dummies
Overview
With this module, you'll understand how to use AI in Mendix in just 5 minutes.
This module demonstrates the simplest "Hello World" examples of using AI in Mendix:
- Ask AI and get a response.
- Chat with AI while retaining history.
- Generate an image.
These use cases are demonstrated through the simplest possible microflows — no complex app structure, no convoluted abstractions, and no bloated domain model. Plain and simple. Even your grandma can get it!
Also included is a microflow demonstrating basic validation and error handling, covering the following scenarios:
- The input is too large.
- The output is too large and was truncated.
- An error occurred when calling the AI.
- The AI responded with empty text (this often happens if the API is overloaded).
To try it out, install the module according to "HowTo" readme documentation, open the app as an administrator, enter your OpenAI credentials, and click the “Hello World” buttons.
For more information, check the _Readme folder inside the module.
Documentation
1) Install these modules
- OpenAI Connector
- GenAI Commons
- Encryption
- Community Commons
2) Configure Encryption module
This app > Settings > Configurations > Edit > Constants > New > Encryption.EncryptionKey
Enter 32 random characters.
3) Roles
In the App security, give these roles to the Administrator app role:
- OpenAIConnector.Administrator
- GenAICommons.Administrator
- MxGenAIConnector.Administrator (not needed in the newer versions of GenAI Commons module, not needed in this module)
4) Pages
Add pages OpenAIConnector.Configuration_Overview and OpenAIConnector.Resources_Overview to the navigation.
5) Get token from Open AI
- https://platform.openai.com/settings/organization/api-keys
- sign in
- + Create new secret key
- Name: any string like "My app"
- Create secret key
- do not forget to top up at least USD 5 at https://platform.openai.com/settings/organization/billing/overview
6) Configuration
- Log in as an administrator
- Open the Configuration_Overview page.
- New
- Display name: any string like "My app"
- API type: OpenAI
- Endpoint: https://api.openai.com/v1/
- Token: (your token from Open AI)
- Save
- Close
- ... > Test > Deployed model: gpt-4.1-mini > Test
- You should see "Success!"
7) Java packages added
This module > Settings > Java Dependencies > New
- Group Id: com.knuddels
- Artifact Id: jtokkit
- Version: 1.1.0