Package io.jmix.reports.llm
Interface LlmDataQueryService
- All Known Implementing Classes:
AiToolsLlmDataQueryService
public interface LlmDataQueryService
Turns a data set prompt into a JPQL query and says whether that query would run. This is the Reports-side
integration seam, used while a report is authored in the designer; a report run executes the stored query
itself and asks nothing of this service. Reports auto-configuration supplies the default AI Tools-backed
implementation, while applications may substitute one.
-
Method Summary
Modifier and TypeMethodDescriptiongenerate(LlmQueryGenerationRequest request) Generates a query for the given prompt.booleanTells whether a query can be generated at all, which the presence of this bean alone does not say: an implementation may be there while the model it talks to is not configured.validate(LlmDataQuery query) Reports what makes a query unrunnable, without running it, without asking a model anything and without correcting anything: a query checked here belongs to whoever wrote it.
-
Method Details
-
isGenerationAvailable
boolean isGenerationAvailable()Tells whether a query can be generated at all, which the presence of this bean alone does not say: an implementation may be there while the model it talks to is not configured. The report designer asks before it offers the data set type, so that a type it offers is a type that works.Every implementation answers it explicitly; one that is always ready returns
true.- Returns:
trueif generation can be performed
-
generate
Generates a query for the given prompt. An implementation may correct a query it finds faulty before answering with it — a generated query is the model's, and no one is waiting to be told about a mistake only the model made.- Parameters:
request- prompt together with the parameters the query may reference- Returns:
- the generated query
- Throws:
LlmDataQueryException- if the query cannot be generated or is rejected as invalid
-
validate
Reports what makes a query unrunnable, without running it, without asking a model anything and without correcting anything: a query checked here belongs to whoever wrote it. The designer asks after a query is generated or edited, so that an author learns of a broken query while looking at it rather than on the next report run.- Parameters:
query- query to check- Returns:
- one message per problem, in no particular order, or an empty list if the query is runnable
-