Class EmbeddingService

java.lang.Object
sk.iway.iwcm.rag.embedding.EmbeddingService

@Service public class EmbeddingService extends Object
Adapts CMS assistant and domain context to the framework-neutral embedding action.
  • Constructor Details

  • Method Details

    • embedWithUsage

      public EmbeddingBatchResult embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, jakarta.servlet.http.HttpServletRequest request) throws ProviderCallException
      Creates document embeddings using provider and model settings from the selected assistant. Provider configuration is resolved from the current request.
      Parameters:
      texts - texts to embed
      assistant - assistant that selects the embedding provider and model
      request - request used to resolve provider configuration
      Returns:
      generated embeddings and token usage, or an empty result when no texts are supplied
      Throws:
      ProviderCallException - if the assistant or provider configuration is invalid, or the provider response cannot be used
    • embedWithUsage

      public EmbeddingBatchResult embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, jakarta.servlet.http.HttpServletRequest request, com.webjetcms.ai.EmbeddingInputType inputType) throws ProviderCallException
      Creates embeddings of the specified input type using request-scoped provider configuration.
      Parameters:
      texts - texts to embed
      assistant - assistant that selects the embedding provider and model
      request - request used to resolve provider configuration
      inputType - embedding input type
      Returns:
      generated embeddings and token usage, or an empty result when no texts are supplied
      Throws:
      ProviderCallException - if the assistant or provider configuration is invalid, or the provider response cannot be used
    • embedWithUsage

      public EmbeddingBatchResult embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, String domainName) throws ProviderCallException
      Creates document embeddings using provider configuration resolved for the specified domain.
      Parameters:
      texts - texts to embed
      assistant - assistant that selects the embedding provider and model
      domainName - domain whose provider configuration should be used
      Returns:
      generated embeddings and token usage, or an empty result when no texts are supplied
      Throws:
      ProviderCallException - if the assistant or provider configuration is invalid, or the provider response cannot be used
    • embedWithUsage

      public EmbeddingBatchResult embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, String domainName, com.webjetcms.ai.EmbeddingInputType inputType) throws ProviderCallException
      Creates embeddings of the specified input type using domain-scoped provider configuration.
      Parameters:
      texts - texts to embed
      assistant - assistant that selects the embedding provider and model
      domainName - domain whose provider configuration should be used
      inputType - embedding input type
      Returns:
      generated embeddings and token usage, or an empty result when no texts are supplied
      Throws:
      ProviderCallException - if the assistant or provider configuration is invalid, or the provider response cannot be used
    • getDimensions

      public int getDimensions()
      Returns the dimension required by the configured vector store.