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 tools.jackson.databind.ObjectMapperprotected ResponseLanguageProviderprotected EntityDataLoadUserMessageComposer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidprotected org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpecprotected voidprotected tools.jackson.databind.ObjectMappergenerate(EntityDataLoadGenerationRequest request) Generates a JPQL query draft for the given 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).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.aitools.dataload.generation.EntityDataLoadGenerationService
generate
-
Field Details
-
chatClientFactory
-
entityDataLoadPromptProvider
-
aiToolRegistry
-
responseLanguageProvider
-
userMessageComposer
-
chatClient
protected @Nullable org.springframework.ai.chat.client.ChatClient chatClient -
objectMapper
protected tools.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 for the given request.- Specified by:
generatein interfaceEntityDataLoadGenerationService- Parameters:
request- the generation request — a prompt and, optionally, the constraints the query must satisfy- Returns:
- generated query draft
-
buildChatClientPrompt
protected org.springframework.ai.chat.client.ChatClient.ChatClientRequestSpec buildChatClientPrompt(EntityDataLoadGenerationRequest request) -
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 tools.jackson.databind.ObjectMapper createObjectMapper()
-