Class PostgresMlEmbeddingModel

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

public class PostgresMlEmbeddingModel extends org.springframework.ai.embedding.AbstractEmbeddingModel implements org.springframework.beans.factory.InitializingBean
PostgresML EmbeddingModel
Author:
Toshiaki Maki, Christian Tzolov, Soby Chacko, Sebastien Deleuze
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel

    embeddingDimensions
  • Constructor Summary

    Constructors
    Constructor
    Description
    PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
    a constructor
    PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options)
     
    PostgresMlEmbeddingModel(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options, boolean createExtension)
    a PostgresMlEmbeddingModel constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    org.springframework.ai.embedding.EmbeddingResponse
    call(org.springframework.ai.embedding.EmbeddingRequest request)
     
    float[]
    embed(String text)
     
    float[]
    embed(org.springframework.ai.document.Document document)
     
    getEmbeddingContent(org.springframework.ai.document.Document document)
     

    Methods inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel

    dimensions, dimensions

    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

    embed, embed, embedForResponse
  • 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)
      Specified by:
      embed in interface org.springframework.ai.embedding.EmbeddingModel
    • getEmbeddingContent

      public String getEmbeddingContent(org.springframework.ai.document.Document document)
      Specified by:
      getEmbeddingContent in interface org.springframework.ai.embedding.EmbeddingModel
    • embed

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

      public org.springframework.ai.embedding.EmbeddingResponse call(org.springframework.ai.embedding.EmbeddingRequest request)
      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>
    • afterPropertiesSet

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