Class OrchestrationSpringEmbeddingModel

java.lang.Object
com.sap.ai.sdk.orchestration.spring.OrchestrationSpringEmbeddingModel
All Implemented Interfaces:
org.springframework.ai.embedding.EmbeddingModel, org.springframework.ai.model.Model<org.springframework.ai.embedding.EmbeddingRequest,org.springframework.ai.embedding.EmbeddingResponse>

public class OrchestrationSpringEmbeddingModel extends Object implements org.springframework.ai.embedding.EmbeddingModel
A Spring-based implementation of the EmbeddingModel interface that integrates with the Orchestration SDK to provide embedding functionality.
Since:
1.13.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    OrchestrationSpringEmbeddingModel(org.springframework.ai.embedding.EmbeddingOptions defaultOptions)
    Constructs an instance with default options, a new OrchestrationClient, and sets the metadata mode to MetadataMode.EMBED.
    OrchestrationSpringEmbeddingModel(org.springframework.ai.embedding.EmbeddingOptions defaultOptions, OrchestrationClient client, org.springframework.ai.document.MetadataMode metadataMode)
    Creates a new OrchestrationSpringEmbeddingModel instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.ai.embedding.EmbeddingResponse
    call(org.springframework.ai.embedding.EmbeddingRequest request)
    Calls the embedding model with the given request and returns the response.
    List<float[]>
    embed(List<String> texts)
     
    float[]
    embed(org.springframework.ai.document.Document document)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.ai.embedding.EmbeddingModel

    dimensions, embed, embed, embedForResponse, getEmbeddingContent
  • Constructor Details

    • OrchestrationSpringEmbeddingModel

      public OrchestrationSpringEmbeddingModel(@Nonnull org.springframework.ai.embedding.EmbeddingOptions defaultOptions)
      Constructs an instance with default options, a new OrchestrationClient, and sets the metadata mode to MetadataMode.EMBED.
      Parameters:
      defaultOptions - Default embedding options.
    • OrchestrationSpringEmbeddingModel

      public OrchestrationSpringEmbeddingModel(@Nonnull org.springframework.ai.embedding.EmbeddingOptions defaultOptions, @Nonnull OrchestrationClient client, @Nonnull org.springframework.ai.document.MetadataMode metadataMode)
      Creates a new OrchestrationSpringEmbeddingModel instance.
      Parameters:
      defaultOptions - Default embedding options to provide model name and other parameters.

      Can be overridden by options in the request.

      client - Client for interacting with the Orchestration SDK.
      metadataMode - Metadata mode to determine how document metadata is handled.
      See Also:
  • Method Details

    • call

      @Nonnull public org.springframework.ai.embedding.EmbeddingResponse call(@Nonnull org.springframework.ai.embedding.EmbeddingRequest request)
      Calls the embedding model with the given request and returns the response.

      Note: The request's options takes precedence over the defaultOptions.

      Specified by:
      call in interface org.springframework.ai.embedding.EmbeddingModel
      Specified by:
      call in interface org.springframework.ai.model.Model<org.springframework.ai.embedding.EmbeddingRequest,org.springframework.ai.embedding.EmbeddingResponse>
      Parameters:
      request - The embedding request containing input texts and options.
      Returns:
      The embedding response containing results and metadata.
    • embed

      @Nonnull public float[] embed(@Nonnull org.springframework.ai.document.Document document)
      Specified by:
      embed in interface org.springframework.ai.embedding.EmbeddingModel
    • embed

      @Nonnull public List<float[]> embed(@Nonnull List<String> texts)
      Specified by:
      embed in interface org.springframework.ai.embedding.EmbeddingModel