Class PostgresMlEmbeddingClient
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingClient
org.springframework.ai.postgresml.PostgresMlEmbeddingClient
- All Implemented Interfaces:
EmbeddingClient,ModelClient<EmbeddingRequest,,EmbeddingResponse> org.springframework.beans.factory.InitializingBean
public class PostgresMlEmbeddingClient
extends AbstractEmbeddingClient
implements org.springframework.beans.factory.InitializingBean
PostgresML EmbeddingClient
- Author:
- Toshiaki Maki, Christian Tzolov
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.springframework.ai.embedding.AbstractEmbeddingClient
embeddingDimensions -
Constructor Summary
ConstructorsConstructorDescriptionPostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) a constructorPostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer) Deprecated, for removal: This API element is subject to removal in a future version.PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer, PostgresMlEmbeddingClient.VectorType vectorType) Deprecated, for removal: This API element is subject to removal in a future version.PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer, PostgresMlEmbeddingClient.VectorType vectorType, Map<String, Object> kwargs, MetadataMode metadataMode) Deprecated, for removal: This API element is subject to removal in a future version.PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options) a PostgresMlEmbeddingClient constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidcall(EmbeddingRequest request) Executes a method call to the AI model.Embeds the given text into a vector.Embeds the given document's content into a vector.Methods inherited from class org.springframework.ai.embedding.AbstractEmbeddingClient
dimensions, dimensionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.embedding.EmbeddingClient
embed, embedForResponse
-
Field Details
-
DEFAULT_TRANSFORMER_MODEL
- See Also:
-
-
Constructor Details
-
PostgresMlEmbeddingClient
public PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) a constructor- Parameters:
jdbcTemplate- JdbcTemplate
-
PostgresMlEmbeddingClient
public PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, PostgresMlEmbeddingOptions options) a PostgresMlEmbeddingClient constructor- Parameters:
jdbcTemplate- JdbcTemplate to use to interact with the database.options- PostgresMlEmbeddingOptions to configure the client.
-
PostgresMlEmbeddingClient
@Deprecated(since="0.8.0", forRemoval=true) public PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer) Deprecated, for removal: This API element is subject to removal in a future version.a constructor- Parameters:
jdbcTemplate- JdbcTemplatetransformer- huggingface sentence-transformer name
-
PostgresMlEmbeddingClient
@Deprecated(since="0.8.0", forRemoval=true) public PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer, PostgresMlEmbeddingClient.VectorType vectorType) Deprecated, for removal: This API element is subject to removal in a future version.Use the constructor withPostgresMlEmbeddingOptionsinstead.a constructor- Parameters:
jdbcTemplate- JdbcTemplatetransformer- huggingface sentence-transformer namevectorType- vector type in PostgreSQL
-
PostgresMlEmbeddingClient
@Deprecated(since="0.8.0", forRemoval=true) public PostgresMlEmbeddingClient(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String transformer, PostgresMlEmbeddingClient.VectorType vectorType, Map<String, Object> kwargs, MetadataMode metadataMode) Deprecated, for removal: This API element is subject to removal in a future version.a constructor * @deprecated Use the constructor withPostgresMlEmbeddingOptionsinstead.- Parameters:
jdbcTemplate- JdbcTemplatetransformer- huggingface sentence-transformer namevectorType- vector type in PostgreSQLkwargs- optional arguments
-
-
Method Details
-
embed
Description copied from interface:EmbeddingClientEmbeds the given text into a vector.- Specified by:
embedin interfaceEmbeddingClient- Parameters:
text- the text to embed.- Returns:
- the embedded vector.
-
embed
Description copied from interface:EmbeddingClientEmbeds the given document's content into a vector.- Specified by:
embedin interfaceEmbeddingClient- Parameters:
document- the document to embed.- Returns:
- the embedded vector.
-
call
Description copied from interface:ModelClientExecutes a method call to the AI model.- Specified by:
callin interfaceEmbeddingClient- Specified by:
callin interfaceModelClient<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:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
PostgresMlEmbeddingOptionsinstead.