Class EntityDataLoadGenerationServiceImpl
java.lang.Object
io.jmix.aitools.dataload.generation.impl.EntityDataLoadGenerationServiceImpl
- All Implemented Interfaces:
EntityDataLoadGenerationService,org.springframework.beans.factory.InitializingBean
@Component("aitls_EntityDataLoadGenerationService")
public class EntityDataLoadGenerationServiceImpl
extends Object
implements EntityDataLoadGenerationService, org.springframework.beans.factory.InitializingBean
Default
EntityDataLoadGenerationService implementation based on an LLM chat client.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AiToolRegistryprotected @Nullable org.springframework.ai.chat.client.ChatClientprotected ChatClientFactoryprotected EntityDataLoadPromptProviderprotected com.fasterxml.jackson.databind.ObjectMapperprotected ResponseLanguageProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidprotected org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpecbuildChatClientPrompt(String userText) protected voidprotected com.fasterxml.jackson.databind.ObjectMapperGenerates a JPQL query draft from the given natural-language request.protected EntityDataLoadQueryprotected Stringprotected @Nullable GeneratedJpqlParameterMaps a parameter payload to aGeneratedJpqlParameter, or returnsnullto skip it when the model provided no parameter name (such a parameter cannot be bound).
-
Field Details
-
chatClientFactory
-
entityDataLoadPromptProvider
-
aiToolRegistry
-
responseLanguageProvider
-
chatClient
protected @Nullable org.springframework.ai.chat.client.ChatClient chatClient -
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
EntityDataLoadGenerationServiceImpl
public EntityDataLoadGenerationServiceImpl()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
generate
Description copied from interface:EntityDataLoadGenerationServiceGenerates a JPQL query draft from the given natural-language request.- Specified by:
generatein interfaceEntityDataLoadGenerationService- Parameters:
userText- user request in natural language- Returns:
- generated query draft
-
buildChatClientPrompt
protected org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec buildChatClientPrompt(String userText) -
buildChatClient
protected void buildChatClient() -
checkChatClient
protected void checkChatClient() -
resolveResponseLanguage
-
mapToQueryDraft
-
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()
-