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 Details

    • chatClientFactory

      @Autowired protected ChatClientFactory chatClientFactory
    • entityDataLoadPromptProvider

      @Autowired protected EntityDataLoadPromptProvider entityDataLoadPromptProvider
    • aiToolRegistry

      @Autowired protected AiToolRegistry aiToolRegistry
    • responseLanguageProvider

      @Autowired protected ResponseLanguageProvider 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:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • generate

      @NullMarked public EntityDataLoadQuery generate(String userText)
      Description copied from interface: EntityDataLoadGenerationService
      Generates a JPQL query draft from the given natural-language request.
      Specified by:
      generate in interface EntityDataLoadGenerationService
      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

      protected String resolveResponseLanguage()
    • mapToQueryDraft

      protected EntityDataLoadQuery mapToQueryDraft(EntityDataLoadQueryPayload payload)
    • toGeneratedJpqlParameter

      protected @Nullable GeneratedJpqlParameter toGeneratedJpqlParameter(GeneratedJpqlParameterPayload payload)
      Maps a parameter payload to a GeneratedJpqlParameter, or returns null to 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 null if it has no usable name
    • createObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper createObjectMapper()