Class DefaultJpqlRepairer
java.lang.Object
io.jmix.aitools.dataload.repair.impl.DefaultJpqlRepairer
- All Implemented Interfaces:
JpqlRepairer,org.springframework.beans.factory.InitializingBean
public class DefaultJpqlRepairer
extends Object
implements JpqlRepairer, org.springframework.beans.factory.InitializingBean
Default
JpqlRepairer that re-prompts the LLM with the previous query and its validation
issues, then parses the corrected JPQL from the model's JSON reply.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChatClientFactoryprotected JpqlRepairerPromptProviderprotected com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes the JSON object mapper after the bean is created.protected com.fasterxml.jackson.databind.ObjectMapperprotected GeneratedJpqlResultexecutePrompt(JpqlRepairRequest request) protected StringformatRepairGuidance(List<JpqlValidationIssue> issues) protected Stringprotected GeneratedJpqlResultprotected Stringrepair(JpqlRepairRequest request) Attempts to repair the invalid query described by the request.protected @Nullable GeneratedJpqlParameterMaps a parameter payload to aGeneratedJpqlParameter, or returnsnullto skip it when the model provided no parameter name (such a parameter cannot be bound).protected String
-
Field Details
-
jpqlRepairerPromptProvider
-
chatClientFactory
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
DefaultJpqlRepairer
public DefaultJpqlRepairer()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()Initializes the JSON object mapper after the bean is created.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
repair
Description copied from interface:JpqlRepairerAttempts to repair the invalid query described by the request.- Specified by:
repairin interfaceJpqlRepairer- Parameters:
request- repair request with the current query- Returns:
- query draft, or
nullif no repaired result could be produced
-
formatValidationIssues
-
formatRepairGuidance
-
executePrompt
-
readPromptTemplate
-
mapToGeneratedJpqlResult
-
toGeneratedJpqlParameter
protected @Nullable GeneratedJpqlParameter toGeneratedJpqlParameter(GeneratedJpqlParameterPayload payload) Maps a parameter payload to aGeneratedJpqlParameter, or returnsnullto skip it when the model provided no parameter name (such a parameter cannot be bound).- Parameters:
payload- raw parameter payload from the model- Returns:
- mapped parameter, or
nullif it has no usable name
-
createObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper createObjectMapper() -
toJson
-