Package org.springframework.ai.embedding
Class TransformersEmbeddingClient
java.lang.Object
org.springframework.ai.embedding.TransformersEmbeddingClient
- All Implemented Interfaces:
EmbeddingClient
,org.springframework.beans.factory.InitializingBean
public class TransformersEmbeddingClient
extends Object
implements EmbeddingClient, org.springframework.beans.factory.InitializingBean
https://www.sbert.net/index.html https://www.sbert.net/docs/pretrained_models.html
- Author:
- Christian Tzolov
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
int
embedForResponse
(List<String> texts) void
setDisableCaching
(boolean disableCaching) void
setEmbeddingDimensions
(int dimension) void
setGpuDeviceId
(int gpuDeviceId) void
setModelResource
(String modelResourceUri) void
setModelResource
(org.springframework.core.io.Resource modelResource) void
setResourceCacheDirectory
(String resourceCacheDir) void
setTokenizerOptions
(Map<String, String> tokenizerOptions) void
setTokenizerResource
(String tokenizerResourceUri) void
setTokenizerResource
(org.springframework.core.io.Resource tokenizerResource)
-
Field Details
-
DEFAULT_ONNX_TOKENIZER_URI
- See Also:
-
DEFAULT_ONNX_MODEL_URI
- See Also:
-
tokenizerOptions
-
-
Constructor Details
-
TransformersEmbeddingClient
public TransformersEmbeddingClient() -
TransformersEmbeddingClient
-
-
Method Details
-
setTokenizerOptions
-
setDisableCaching
public void setDisableCaching(boolean disableCaching) -
setResourceCacheDirectory
-
setGpuDeviceId
public void setGpuDeviceId(int gpuDeviceId) -
setTokenizerResource
public void setTokenizerResource(org.springframework.core.io.Resource tokenizerResource) -
setModelResource
public void setModelResource(org.springframework.core.io.Resource modelResource) -
setTokenizerResource
-
setModelResource
-
setEmbeddingDimensions
public void setEmbeddingDimensions(int dimension) -
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
embed
- Specified by:
embed
in interfaceEmbeddingClient
-
embed
- Specified by:
embed
in interfaceEmbeddingClient
-
embedForResponse
- Specified by:
embedForResponse
in interfaceEmbeddingClient
-
embed
- Specified by:
embed
in interfaceEmbeddingClient
-
dimensions
public int dimensions()- Specified by:
dimensions
in interfaceEmbeddingClient
-