This version is still in development and is not considered stable yet. For the latest snapshot version, please use Spring AI 1.0.0-SNAPSHOT! |
Refer to the Dependency Management section to add the Spring AI BOM to your build file. Refer to the Repositories section to add these repositories to your build system. |
Property | Description | Default |
---|---|---|
spring.ai.embedding.transformer.enabled |
Enable the Transformer Embedding model. |
true |
spring.ai.embedding.transformer.tokenizer.uri |
URI of a pre-trained HuggingFaceTokenizer created by the ONNX engine (e.g. tokenizer.json). |
onnx/all-MiniLM-L6-v2/tokenizer.json |
spring.ai.embedding.transformer.tokenizer.options |
HuggingFaceTokenizer options such as ‘addSpecialTokens’, ‘modelMaxLength’, ‘truncation’, ‘padding’, ‘maxLength’, ‘stride’, ‘padToMultipleOf’. Leave empty to fallback to the defaults. |
empty |
spring.ai.embedding.transformer.cache.enabled |
Enable remote Resource caching. |
true |
spring.ai.embedding.transformer.cache.directory |
Directory path to cache remote resources, such as the ONNX models |
${java.io.tmpdir}/spring-ai-onnx-model |
spring.ai.embedding.transformer.onnx.modelUri |
Existing, pre-trained ONNX model. |
onnx/all-MiniLM-L6-v2/model.onnx |
spring.ai.embedding.transformer.onnx.modelOutputName |
The ONNX model’s output node name, which we’ll use for embedding calculation. |
last_hidden_state |
spring.ai.embedding.transformer.onnx.gpuDeviceId |
The GPU device ID to execute on. Only applicable if >= 0. Ignored otherwise.(Requires additional onnxruntime_gpu dependency) |
-1 |
spring.ai.embedding.transformer.metadataMode |
Specifies what parts of the Documents content and metadata will be used for computing the embeddings. |
NONE |
If you see an error like spring.ai.embedding.transformer.tokenizer.options.padding=true |
If you get an error like spring.ai.embedding.transformer.onnx.modelOutputName=token_embeddings |
If you get an error like The Currently the only workaround is to copy the large |
If you get an error like <dependency> <groupId>com.microsoft.onnxruntime</groupId> <artifactId>onnxruntime_gpu</artifactId> </dependency> Please select the appropriate onnxruntime_gpu version based on the CUDA version(ONNX Java Runtime). |
Refer to the Dependency Management section to add the Spring AI BOM to your build file. |
Dimensions |
384 |
Avg. performance |
58.80 |
Speed |
14200 sentences/sec |
Size |
80MB |
If you create an instance of TransformersEmbeddingModel manually, you must call the afterPropertiesSet() method after setting the properties and before using the client.
|