If you’ve been following this series, you’ll recall that in our last episode we delved deep into the mysteries of why Mendix and ChatGPT should even be in the same room together! The intrigue! The suspense! Who would’ve thought we’d see the day? But here we are, at the crossroads of innovation and… let’s admit it, a bit of geeky fun. Our tools are ready from the last tutorial and we are about to get the first glimpse into the wonderful world of low-code, APIs and systems integratoin. So, buckle up, because today we’re diving straight into the HOW.
Mendix Installation
- We already mentioned this step in our previous article, but it’s worth refreshing our memory
- Begin with downloading the Mendix Studio Pro from the official website.
- Follow the installation prompts until complete.
Creating a New App from a Template
- First we will need to sign in Studio Pro
- Click on ‘New App’.
- Browse the available templates.
- Select one that best fits your project needs and click ‘Create’.
Modules Creation for the Project
We already know we are going to require a few different modules or “customer request” from our previous article. One of the requests was to be able to manage or create different “personas”, another was to be able to manage and relate “conversations” and a third one, not specifically requested, but surely important, will be some “cost analytics”.
- Navigate to the ‘Modules’ tab.
- Click on ‘New Module’.
- Name it ‘PersonaManager’ and click ‘Create’.
- Repeat the steps, naming the subsequent modules ‘ConversationManager’ and ‘CostAnalytics’.
Browsing the Mendix Marketplace for OpenAI Module
One of the great things about Mendix it’s the rich ecosystem of created plugins, modules and services that can be found in the marketplace. From different widgets to improve your visuals, to fully working standard modules and API calls to several systems like Single Sign On, SAP, Salesforce and many more.
- Head to the ‘Marketplace’ tab.
- Use the search bar to look for ‘OpenAI’.
- Find the most relevant OpenAI module and click ‘Download’.
- Modules and plugins usually include helpful “Read_Me” and usually a “Use_Me” page or flow to get started.
Setting up the OpenAI API Keys
In our previous episode we discovered that we will need an OpenAI API account (paid), and an API key. Let’s head to the OpenAI portal and generate one.
- Go to API Keys and click “Generate New Key”
- Save the key value somwhere, you will not be able to see it again.
- Back in the Mendix Studio, locate the ChatGPT3 module, find the “CONST_APIKey_ChatGPT”.
- Enter your OpenAI API key in the default value field.
- Save the changes.
Saving hard coded credentials or API keys is not a best practices, but for our current demos will be enough. Once we get things working, we will create a better way to manage our key secrets.
Creating a Testing Page
Now we need to create some pages to interact with ChatGPT, lucky for us, the module we downloaded somes with a default page that has all the basics we need.
- Find the Navigation section of the project.
- Click on ‘Home’.
- Find the page “ChatGPT3.ChatGPT_Overview”.
- Check the information area for any errors.
Running a Local Testing Instance
One of those great memes in programming and coding is the phrase “it works on my computer” when somethin goes wrong. This is not the case with Mendix, when running a test instance, we can be sure that it will run exactly the same in production, once uploaded to the cloud. So, now that our first page is ready, let’s give it a try!
- Click on the ‘Run Locally’ option.
- Wait for the local server to start.
- Click on “View App” and select “the browser option”Responsive View”.
- A new broswer windows will open and we are ready to test!
Conclusion
And there you have it! The Mendix and ChatGPT, intertwined in a dance of digital synergy. But wait, don’t close that tab just yet! Our adventure doesn’t end here. Remember those intriguing modules we whipped up earlier? Oh, we have plans for them. Big plans. So, stay tuned for our upcoming episodes as we continue our thrilling journey into the realm of Mendix and ChatGPT. Until then, keep those low-coding fingers nimble!