Class PostgresMlEmbeddingModel

java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.postgresml.PostgresMlEmbeddingModel
All Implemented Interfaces:
EmbeddingModel, Model<EmbeddingRequest,EmbeddingResponse>, org.springframework.beans.factory.InitializingBean

public class PostgresMlEmbeddingModel extends AbstractEmbeddingModel implements org.springframework.beans.factory.InitializingBean
PostgresML EmbeddingModel
Author:
Toshiaki Maki, Christian Tzolov
  • Field Details

  • Constructor Details

    • PostgresMlEmbeddingModel

      public PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
      a constructor
      Parameters:
      jdbcTemplate - JdbcTemplate
    • PostgresMlEmbeddingModel

      public PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options)
    • PostgresMlEmbeddingModel

      public PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options, boolean createExtension)
      a PostgresMlEmbeddingModel constructor
      Parameters:
      jdbcTemplate - JdbcTemplate to use to interact with the database.
      options - PostgresMlEmbeddingOptions to configure the client.
  • Method Details

    • embed

      public float[] embed(String text)
      Description copied from interface: EmbeddingModel
      Embeds the given text into a vector.
      Specified by:
      embed in interface EmbeddingModel
      Parameters:
      text - the text to embed.
      Returns:
      the embedded vector.
    • embed

      public float[] embed(Document document)
      Description copied from interface: EmbeddingModel
      Embeds the given document's content into a vector.
      Specified by:
      embed in interface EmbeddingModel
      Parameters:
      document - the document to embed.
      Returns:
      the embedded vector.
    • call

      public EmbeddingResponse call(EmbeddingRequest request)
      Description copied from interface: Model
      Executes a method call to the AI model.
      Specified by:
      call in interface EmbeddingModel
      Specified by:
      call in interface Model<EmbeddingRequest,EmbeddingResponse>
      Parameters:
      request - the request object to be sent to the AI model
      Returns:
      the response from the AI model
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean