OpenXava 7.7 introduces an AI-powered chat assistant that allows users to interact with your application data using natural language. The chat panel is integrated directly into the OpenXava user interface and provides a conversational way to query, filter, and even modify data.
The AI chat uses LangChain4j to connect to OpenAI-compatible language models, enabling sophisticated natural language understanding. Users can ask questions about their data, request filtering of lists, and perform data modifications—all through simple conversational commands.
The AI chat provides a rich set of capabilities for end users:
Users can ask questions about their data in natural language:
The chat can access data from any module, not just the currently open one. For example, while viewing customers, you can ask about products or invoices.
The chat also supports accessing data from element collections and related entities, allowing complex queries like "Tell me what products have been invoiced in invoice 2021/1".
Users can filter the current list using natural language:
The filtering works with multiple fields, dates, and comparators (greater than, less than, etc.). When the user is in list mode of the corresponding module, the filter is applied directly to the list. When in detail mode or a different module, the results are returned in the chat response.
Users can modify data through natural language commands:
The chat respects the editable/read-only status of fields. If a field is not editable, the chat will not modify it, even if the user requests it.
Advanced modifications: The AI can perform sophisticated bulk operations that would otherwise require custom actions. For example, you can say "Increase the price of all cars by 10%" and the AI will understand and execute this operation across all matching records—without needing a specific "vehicle type" field or a dedicated action in the application.
The chat understands and responds in multiple languages. Users can ask questions in Spanish, English, or other languages:
The chat maintains conversation context, allowing follow-up questions:
Users can start a new conversation by clicking the "New conversation" button, which clears the memory.
The chat always works with the current state of the data. If you add a new customer and then ask "How many customers do I have now?", it will reflect the updated count.
Projects created with OpenXava 7.7 or later already include the AI chat dependency. No additional setup is required beyond configuring the API key.
If you are upgrading from a version prior to 7.7, you need to add the AI chat dependency to your pom.xml:
<!-- AI Chat functionality (requires Java 17) -->
<dependency>
<groupId>org.openxava</groupId>
<artifactId>openxava-7.7-chat-jdk17</artifactId>
<version>${openxava.version}</version>
</dependency>
Important: This dependency requires Java 17 or later. If your project uses Java 8 or 11, you will need to upgrade to Java 17 to use the AI chat feature. The rest of OpenXava 7.7 continues to work with Java 8.
The AI chat can be configured through properties in your xava.properties file:
Specifies the AI model to use. The default is gpt-5-mini.
# AI model to use for chat
chatModelName=gpt-5-mini
We recommend using gpt-5-mini as the minimum model for good behavior. Smaller or less capable models may not understand complex queries or may produce incorrect results. You can also use more powerful models like gpt-5 for even better results, though they may be slower and more expensive.
Enables or disables the chat feature. The default is true.
# Set to false to disable the AI chat
chatAvailable=false
When set to false, the chat button and panel will not appear in the user interface.
Enables or disables the ability to modify data through the chat. The default is true.
# Set to false to make the chat read-only
chatModifyDataAvailable=false
When set to false, users can query and filter data but cannot modify it through the chat. This is useful for environments where you want to provide AI-powered querying without the risk of accidental data modifications.
Enables or disables the priority service tier for OpenAI API calls. The default is true.
# Set to false to use standard service tier
chatPriorityServiceTier=false
When enabled, the chat uses OpenAI's priority service tier which may provide faster response times.
The AI chat requires an OpenAI API key to function. You must set the OPENAI_API_KEY environment variable with your API key:
# Linux/macOS
export OPENAI_API_KEY=your-api-key-here
# Windows
set OPENAI_API_KEY=your-api-key-here
You can obtain an API key from OpenAI's platform.
Security note: Never hardcode your API key in source code or configuration files that may be committed to version control. Always use environment variables or secure secret management solutions.