AI for Dummies

Content Type: Module
Categories: Artificial Intelligence

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:

  1. OpenAIConnector.Administrator
  2. GenAICommons.Administrator
  3. 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

  1. https://platform.openai.com/settings/organization/api-keys
  2. sign in
  3. + Create new secret key
  4. Name: any string like "My app"
  5. Create secret key
  6. do not forget to top up at least USD 5 at https://platform.openai.com/settings/organization/billing/overview

6) Configuration

  1. Log in as an administrator
  2. Open the Configuration_Overview page.
  3. New
  4. Display name: any string like "My app"
  5. API type: OpenAI
  6. Endpoint: https://api.openai.com/v1/
  7. Token: (your token from Open AI)
  8. Save
  9. Close
  10. ... > Test > Deployed model: gpt-4.1-mini > Test
  11. 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

Releases

Version: 1.0.0
Framework Version: 10.23.0
Release Notes: The first version.