Agentic Engineering & ToolingAgentic Engineering & Tooling
Lunch Talk40min
BEGINNER

From User Prompt to JPA Query: Comparing Tool Calling, Structured Output & Hybrid Approach

The project compares three LLM approaches for natural-language database filtering in a Java Spring AI/Vaadin app: function calling, structured output, and a hybrid method. Tested with local Ollama models, it evaluates reliability, speed, cost, and limitations for handling complex filter requests.

talk.summaryAiDisclaimer

Sebastian Kühnau
Sebastian KühnauVaadin

talkDetail.whenAndWhere

Wednesday, October 7, 13:05-13:45
Room 5
talks.description
With Java, data can be loaded easily from different sources and displayed in a web UI with little effort. However, as soon as users need to search for specific records, applications often rely on complex filter forms. Modern LLMs offer an alternative: they can extract filter criteria from natural language and turn them into suitable database queries.

Using an example project built with Spring AI and Vaadin, we compare three possible approaches. With Function Calling, the model invokes tool functions in the application code and passes the required parameters. This is easy to understand, but in a simple implementation it quickly reaches its limits when handling complex requests involving negations, operators, or multiple values. Structured Output, on the other hand, directly creates a custom filter object and can represent more complex requests in a compact form. A hybrid approach combines both concepts by using a tool call whose parameters themselves contain a structured filter definition.

All approaches are tested with the same queries against local Ollama models. We compare which approach is more reliable, faster, and more cost-efficient, and examine where each of them reaches its limits.
java
llm
structuredoutput
filtering
talks.speakers
Sebastian Kühnau

Sebastian Kühnau

Vaadin

Germany

Sebastian has been a Java junkie for over two decades and fell in love with Vaadin during his university days. Since 2016, he has worked in various technical roles at Vaadin, helping customers build tailor-made web applications and leading workshops and training sessions. In 2024, he transitioned to looking after the community full-time, traveling from event to event as a speaker to share his knowledge and passion for Vaadin. When he’s not at a conference or experimenting with AI, he’s always up for a tech talk and a good cup of coffee.