Hi Pranav,
that is indeed possible and we have a lot of examples that demonstrate that pattern (most often used via function/tool calling).
Check out the following resources:
I hope that helps!
Best regards,
Liam
A. Mendix Setup
Create Non-Persistable Entities (NPEs): UserQuery
, ChatResponse
Design a page with:
Input field for the user's natural language query
Button to trigger the microflow
View to show chatbot response
Use a microflow to process the query
B. OpenAI Integration
Install OpenAI Connector from Mendix Marketplacehttps://marketplace.mendix.com/link/component/209241
Use system prompt to request structured JSON from the model
Send user query to OpenAI using the connector
Parse the response using StringToJSON
or JavaScript action
C. Fetching Data from Mendix
Create sub-microflows for different intents:
getEmployeeProfile
getCurrentDepartment
getEmploymentHistory
Use XPath or associations to retrieve related data
Use dynamic logic in the main microflow to route based on intent
D. Security Considerations
Apply role-based access to entities and microflows
Sanitize user inputs to prevent prompt injection
Log all chatbot interactions for auditing
E. Optional Enhancements
Use Azure OpenAI if enterprise security or compliance is required
Use vector search for unstructured data like resumes or comments
Add browser-based voice-to-text input for user convenience
F. Reference Links
OpenAI Connector:https://marketplace.mendix.com/link/component/209241
Non-Persistable Entities:https://docs.mendix.com/refguide/non-persistable-entities/
Microflows:https://docs.mendix.com/refguide/microflows/
XPath & Associations:https://docs.mendix.com/refguide/xpath/
OpenAI Chat API:https://platform.openai.com/docs/guides/gpt/chat-completions-api
Prompt Engineering:https://platform.openai.com/docs/guides/gpt-best-practices
LLM Security (OWASP):https://owasp.org/www-project-top-10-for-large-language-model-applications/