Package sk.iway.iwcm.rag.embedding
Class EmbeddingService
java.lang.Object
sk.iway.iwcm.rag.embedding.EmbeddingService
Adapts CMS assistant and domain context to the framework-neutral embedding action.
-
Constructor Summary
ConstructorsConstructorDescriptionEmbeddingService(com.webjetcms.ai.AiClient aiClient, WebjetAiConfigurationService configurationService, List<AiInterface> providers) -
Method Summary
Modifier and TypeMethodDescriptionembedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, jakarta.servlet.http.HttpServletRequest request) Creates document embeddings using provider and model settings from the selected assistant.embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, jakarta.servlet.http.HttpServletRequest request, com.webjetcms.ai.EmbeddingInputType inputType) Creates embeddings of the specified input type using request-scoped provider configuration.embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, String domainName) Creates document embeddings using provider configuration resolved for the specified domain.embedWithUsage(List<String> texts, AssistantDefinitionEntity assistant, String domainName, com.webjetcms.ai.EmbeddingInputType inputType) Creates embeddings of the specified input type using domain-scoped provider configuration.intReturns the dimension required by the configured vector store.
-
Constructor Details
-
EmbeddingService
public EmbeddingService(com.webjetcms.ai.AiClient aiClient, WebjetAiConfigurationService configurationService, List<AiInterface> providers)
-
-
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 embedassistant- assistant that selects the embedding provider and modelrequest- 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 embedassistant- assistant that selects the embedding provider and modelrequest- request used to resolve provider configurationinputType- 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 embedassistant- assistant that selects the embedding provider and modeldomainName- 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 embedassistant- assistant that selects the embedding provider and modeldomainName- domain whose provider configuration should be usedinputType- 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.
-