From 958549ecce7693f48daae37be022ff7c6ec1e562 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Sun, 16 Jun 2024 21:24:03 +0200 Subject: [PATCH] Rename all Embedding Client doc and variables occurrences into Embedding Model --- .../ai/minimax/MiniMaxEmbeddingModel.java | 2 +- .../ai/openai/OpenAiEmbeddingModel.java | 2 +- .../ai/zhipuai/ZhiPuAiEmbeddingModel.java | 2 +- .../ROOT/pages/api/chat/ollama-chat.adoc | 2 +- .../modules/ROOT/pages/api/embeddings.adoc | 4 ++-- .../embeddings/azure-openai-embeddings.adoc | 2 +- .../embeddings/bedrock-cohere-embedding.adoc | 4 ++-- .../embeddings/bedrock-titan-embedding.adoc | 4 ++-- .../api/embeddings/minimax-embeddings.adoc | 6 +++--- .../api/embeddings/mistralai-embeddings.adoc | 6 +++--- .../api/embeddings/ollama-embeddings.adoc | 2 +- .../ROOT/pages/api/embeddings/onnx.adoc | 2 +- .../api/embeddings/openai-embeddings.adoc | 6 +++--- .../api/embeddings/postgresml-embeddings.adoc | 2 +- .../api/embeddings/vertexai-embeddings.adoc | 8 ++++---- .../api/embeddings/zhipuai-embeddings.adoc | 6 +++--- .../pages/api/vectordbs/apache-cassandra.adoc | 2 +- .../ROOT/pages/api/vectordbs/gemfire.adoc | 2 +- .../ROOT/pages/api/vectordbs/typesense.adoc | 18 ++++++++--------- .../ROOT/pages/api/vectordbs/weaviate.adoc | 2 +- spring-ai-spring-boot-autoconfigure/pom.xml | 2 +- ...drockCohereEmbeddingAutoConfiguration.java | 2 +- .../BedrockCohereEmbeddingProperties.java | 2 +- ...edrockTitanEmbeddingAutoConfiguration.java | 2 +- .../BedrockTitanEmbeddingProperties.java | 2 +- .../TransformersEmbeddingModelProperties.java | 2 +- ...TypesenseVectorStoreAutoConfiguration.java | 4 ++-- ...pesenseVectorStoreAutoConfigurationIT.java | 2 +- spring-ai-spring-boot-docker-compose/pom.xml | 2 +- spring-ai-spring-boot-testcontainers/pom.xml | 2 +- .../ai/vectorstore/CassandraVectorStore.java | 2 +- .../ai/vectorstore/Neo4jVectorStore.java | 2 +- .../ai/vectorstore/RedisVectorStore.java | 2 +- .../ai/vectorstore/TypesenseVectorStore.java | 20 +++++++++---------- .../vectorstore/TypesenseVectorStoreIT.java | 8 ++++---- 35 files changed, 70 insertions(+), 70 deletions(-) diff --git a/models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/MiniMaxEmbeddingModel.java b/models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/MiniMaxEmbeddingModel.java index f66eba408..0273764a2 100644 --- a/models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/MiniMaxEmbeddingModel.java +++ b/models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/MiniMaxEmbeddingModel.java @@ -35,7 +35,7 @@ import java.util.ArrayList; import java.util.List; /** - * MiniMax Embedding Client implementation. + * MiniMax Embedding Model implementation. * * @author Geng Rong * @since 1.0.0 M1 diff --git a/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiEmbeddingModel.java b/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiEmbeddingModel.java index 7192d2771..ad9ffd712 100644 --- a/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiEmbeddingModel.java +++ b/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiEmbeddingModel.java @@ -37,7 +37,7 @@ import org.springframework.retry.support.RetryTemplate; import org.springframework.util.Assert; /** - * Open AI Embedding Client implementation. + * Open AI Embedding Model implementation. * * @author Christian Tzolov */ diff --git a/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/ZhiPuAiEmbeddingModel.java b/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/ZhiPuAiEmbeddingModel.java index 9dc29fc6d..3ee5db59f 100644 --- a/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/ZhiPuAiEmbeddingModel.java +++ b/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/ZhiPuAiEmbeddingModel.java @@ -35,7 +35,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; /** - * ZhiPuAI Embedding Client implementation. + * ZhiPuAI Embedding Model implementation. * * @author Geng Rong * @since 1.0.0 M1 diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/ollama-chat.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/ollama-chat.adoc index df8a98146..31b5fe461 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/ollama-chat.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/ollama-chat.adoc @@ -241,7 +241,7 @@ dependencies { TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file. TIP: The `spring-ai-ollama` dependency provides access also to the `OllamaEmbeddingModel`. -For more information about the `OllamaEmbeddingModel` refer to the link:../embeddings/ollama-embeddings.html[Ollama Embedding Client] section. +For more information about the `OllamaEmbeddingModel` refer to the link:../embeddings/ollama-embeddings.html[Ollama Embedding MOdel] section. Next, create an `OllamaChatModel` instance and use it to text generations requests: diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc index d6140e23d..3f84b9c42 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc @@ -19,9 +19,9 @@ By providing straightforward methods like `embed(String text)` and `embed(Docume The Embedding Model API is built on top of the generic https://github.com/spring-projects/spring-ai/tree/main/spring-ai-core/src/main/java/org/springframework/ai/model[Spring AI Model API], which is a part of the Spring AI library. As such, the EmbeddingModel interface extends the `Model` interface, which provides a standard set of methods for interacting with AI models. The `EmbeddingRequest` and `EmbeddingResponse` classes extend from the `ModelRequest` and `ModelResponse` are used to encapsulate the input and output of the embedding models, respectively. -The Embedding API in turn is used by higher-level components to implement Embedding Clients for specific embedding models, such as OpenAI, Titan, Azure OpenAI, Ollie, and others. +The Embedding API in turn is used by higher-level components to implement Embedding Models for specific embedding models, such as OpenAI, Titan, Azure OpenAI, Ollie, and others. -Following diagram illustrates the Embedding API and its relationship with the Spring AI Model API and the Embedding Clients: +Following diagram illustrates the Embedding API and its relationship with the Spring AI Model API and the Embedding Models: image:embeddings-api.jpg[title=Embeddings API,align=center,width=900] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/azure-openai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/azure-openai-embeddings.adoc index 53ae973dc..508658070 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/azure-openai-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/azure-openai-embeddings.adoc @@ -31,7 +31,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure OpenAI Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure OpenAI Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-cohere-embedding.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-cohere-embedding.adoc index e4dcee9b6..174eeb5e3 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-cohere-embedding.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-cohere-embedding.adoc @@ -1,6 +1,6 @@ = Cohere Embeddings -Provides Bedrock Cohere Embedding client. +Provides Bedrock Cohere Embedding model. Integrate generative AI capabilities into essential apps and workflows that improve business outcomes. The https://aws.amazon.com/bedrock/cohere-command-embed/[AWS Bedrock Cohere Model Page] and https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html[Amazon Bedrock User Guide] contains detailed information on how to use the AWS hosted model. @@ -101,7 +101,7 @@ EmbeddingResponse embeddingResponse = embeddingModel.call( https://start.spring.io/[Create] a new Spring Boot project and add the `spring-ai-bedrock-ai-spring-boot-starter` to your pom (or gradle) dependencies. -Add a `application.properties` file, under the `src/main/resources` directory, to enable and configure the Cohere Embedding client: +Add a `application.properties` file, under the `src/main/resources` directory, to enable and configure the Cohere Embedding model: [source] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-titan-embedding.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-titan-embedding.adoc index b93685458..4e1bae577 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-titan-embedding.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/bedrock-titan-embedding.adoc @@ -1,6 +1,6 @@ = Titan Embeddings -Provides Bedrock Titan Embedding client. +Provides Bedrock Titan Embedding model. link:https://aws.amazon.com/bedrock/titan/[Amazon Titan] foundation models (FMs) provide customers with a breadth of high-performing image, multimodal embeddings, and text model choices, via a fully managed API. Amazon Titan models are created by AWS and pretrained on large datasets, making them powerful, general-purpose models built to support a variety of use cases, while also supporting the responsible use of AI. Use them as is or privately customize them with your own data. @@ -102,7 +102,7 @@ EmbeddingResponse embeddingResponse = embeddingModel.call( https://start.spring.io/[Create] a new Spring Boot project and add the `spring-ai-bedrock-ai-spring-boot-starter` to your pom (or gradle) dependencies. -Add a `application.properties` file, under the `src/main/resources` directory, to enable and configure the Titan Embedding client: +Add a `application.properties` file, under the `src/main/resources` directory, to enable and configure the Titan Embedding model: [source] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/minimax-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/minimax-embeddings.adoc index f554b4664..2216ca2f2 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/minimax-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/minimax-embeddings.adoc @@ -26,7 +26,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure MiniMax Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure MiniMax Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] @@ -52,7 +52,7 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man ==== Retry Properties -The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the MiniMax Embedding client. +The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the MiniMax Embedding model. [cols="3,5,1"] |==== @@ -153,7 +153,7 @@ public class EmbeddingController { == Manual Configuration -If you are not using Spring Boot, you can manually configure the MiniMax Embedding Client. +If you are not using Spring Boot, you can manually configure the MiniMax Embedding Model. For this add the `spring-ai-minimax` dependency to your project's Maven `pom.xml` file: [source, xml] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc index 77afada94..c8ac4a23c 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc @@ -25,7 +25,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the MistralAI Embedding Client. +Spring AI provides Spring Boot auto-configuration for the MistralAI Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] @@ -51,7 +51,7 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man ==== Retry Properties -The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the Mistral AI Embedding client. +The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the Mistral AI Embedding model. [cols="3,5,1"] |==== @@ -154,7 +154,7 @@ public class EmbeddingController { == Manual Configuration -If you are not using Spring Boot, you can manually configure the OpenAI Embedding Client. +If you are not using Spring Boot, you can manually configure the OpenAI Embedding Model. For this add the `spring-ai-mistral-ai` dependency to your project's Maven `pom.xml` file: [source, xml] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/ollama-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/ollama-embeddings.adoc index 85d64c301..f7a710034 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/ollama-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/ollama-embeddings.adoc @@ -24,7 +24,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure Ollama Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure Ollama Embedding Mpdel. To enable it add the following dependency to your Maven `pom.xml` file: [source,xml] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc index a57d6f23d..fa5e81e8a 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc @@ -128,7 +128,7 @@ The complete list of supported properties are: |=== | Property | Description | Default -| spring.ai.embedding.transformer.enabled | Enable the Transformer Embedding client. | true +| 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 diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/openai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/openai-embeddings.adoc index b57ee6cda..fe1e98f99 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/openai-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/openai-embeddings.adoc @@ -26,7 +26,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure OpenAI Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure OpenAI Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] @@ -52,7 +52,7 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man ==== Retry Properties -The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the OpenAI Embedding client. +The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the OpenAI Embedding model. [cols="3,5,1"] |==== @@ -157,7 +157,7 @@ public class EmbeddingController { == Manual Configuration -If you are not using Spring Boot, you can manually configure the OpenAI Embedding Client. +If you are not using Spring Boot, you can manually configure the OpenAI Embedding Model. For this add the `spring-ai-openai` dependency to your project's Maven `pom.xml` file: [source, xml] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/postgresml-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/postgresml-embeddings.adoc index 7082b5757..bb2376162 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/postgresml-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/postgresml-embeddings.adoc @@ -18,7 +18,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure PostgresML Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure PostgresML Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/vertexai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/vertexai-embeddings.adoc index 34e8bcd7a..36b59bf3b 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/vertexai-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/vertexai-embeddings.adoc @@ -27,7 +27,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the VertexAI Embedding Client. +Spring AI provides Spring Boot auto-configuration for the VertexAI Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] @@ -61,13 +61,13 @@ The prefix `spring.ai.vertex.ai` is used as the property prefix that lets you co | spring.ai.vertex.ai.api-key | The API Key | - |==== -The prefix `spring.ai.vertex.ai.embedding` is the property prefix that lets you configure the embedding client implementation for VertexAI Chat. +The prefix `spring.ai.vertex.ai.embedding` is the property prefix that lets you configure the embedding model implementation for VertexAI Chat. [cols="3,5,1"] |==== | Property | Description | Default -| spring.ai.vertex.ai.embedding.enabled | Enable Vertex AI PaLM API Embedding client. | true +| spring.ai.vertex.ai.embedding.enabled | Enable Vertex AI PaLM API Embedding model. | true | spring.ai.vertex.ai.embedding.model | This is the https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/text-embeddings[Vertex Embedding model] to use | embedding-gecko-001 |==== @@ -87,7 +87,7 @@ spring.ai.vertex.ai.embedding.model=embedding-gecko-001 TIP: replace the `api-key` with your VertexAI credentials. This will create a `VertexAiPaLm2EmbeddingModel` implementation that you can inject into your class. -Here is an example of a simple `@Controller` class that uses the embedding client for text generations. +Here is an example of a simple `@Controller` class that uses the embedding model for text generations. [source,java] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/zhipuai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/zhipuai-embeddings.adoc index 1ad2abdca..7ddd5f03a 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/zhipuai-embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/zhipuai-embeddings.adoc @@ -26,7 +26,7 @@ To help with dependency management, Spring AI provides a BOM (bill of materials) == Auto-configuration -Spring AI provides Spring Boot auto-configuration for the Azure ZhiPuAI Embedding Client. +Spring AI provides Spring Boot auto-configuration for the Azure ZhiPuAI Embedding Model. To enable it add the following dependency to your project's Maven `pom.xml` file: [source, xml] @@ -52,7 +52,7 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man ==== Retry Properties -The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the ZhiPuAI Embedding client. +The prefix `spring.ai.retry` is used as the property prefix that lets you configure the retry mechanism for the ZhiPuAI Embedding model. [cols="3,5,1"] |==== @@ -153,7 +153,7 @@ public class EmbeddingController { == Manual Configuration -If you are not using Spring Boot, you can manually configure the ZhiPuAI Embedding Client. +If you are not using Spring Boot, you can manually configure the ZhiPuAI Embedding Model. For this add the `spring-ai-zhipuai` dependency to your project's Maven `pom.xml` file: [source, xml] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/apache-cassandra.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/apache-cassandra.adoc index 099777059..6e1b407e1 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/apache-cassandra.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/apache-cassandra.adoc @@ -68,7 +68,7 @@ Add these dependencies to your project: ---- -* Or, for everything you need in a RAG application (using the default ONNX Embedding Client) +* Or, for everything you need in a RAG application (using the default ONNX Embedding Model) [source,xml] ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/gemfire.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/gemfire.adoc index 1ccb7add3..d67d9f67d 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/gemfire.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/gemfire.adoc @@ -20,7 +20,7 @@ You can download the GemFire VectorDB extension from the link:https://network.pi Add these dependencies to your project: -- Embedding Client boot starter, required for calculating embeddings. +- Embedding Model boot starter, required for calculating embeddings. - Transformers Embedding (Local) and follow the ONNX Transformers Embedding instructions. [source,xml] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/typesense.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/typesense.adoc index e48aaa975..9acbc3379 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/typesense.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/typesense.adoc @@ -10,8 +10,8 @@ link:https://typesense.org[Typesense] Typesense is an open source, typo tolerant - link:https://typesense.org/docs/guide/install-typesense.html[Typesense Cloud] (recommended) - link:https://hub.docker.com/r/typesense/typesense/[Docker] image _typesense/typesense:latest_ -2. `EmbeddingClient` instance to compute the document embeddings. Several options are available: -- If required, an API key for the xref:api/embeddings.adoc#available-implementations[EmbeddingClient] to generate the embeddings stored by the `TypesenseVectorStore`. +2. `EmbeddingModel` instance to compute the document embeddings. Several options are available: +- If required, an API key for the xref:api/embeddings.adoc#available-implementations[EmbeddingModel] to generate the embeddings stored by the `TypesenseVectorStore`. == Auto-configuration @@ -39,16 +39,16 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man TIP: Refer to the xref:getting-started.adoc#repositories[Repositories] section to add Milestone and/or Snapshot Repositories to your build file. -Additionally, you will need a configured `EmbeddingClient` bean. Refer to the xref:api/embeddings.adoc#available-implementations[EmbeddingClient] section for more information. +Additionally, you will need a configured `EmbeddingModel` bean. Refer to the xref:api/embeddings.adoc#available-implementations[EmbeddingModel] section for more information. Here is an example of the needed bean: [source,java] ---- @Bean -public EmbeddingClient embeddingClient() { - // Can be any other EmbeddingClient implementation. - return new OpenAiEmbeddingClient(new OpenAiApi(System.getenv("SPRING_AI_OPENAI_API_KEY"))); +public EmbeddingModel embeddingModel() { + // Can be any other EmbeddingModel implementation. + return new OpenAiEmbeddingModel(new OpenAiApi(System.getenv("SPRING_AI_OPENAI_API_KEY"))); } ---- @@ -175,14 +175,14 @@ Then, create a `TypesenseVectorStore` bean in your Spring configuration: [source,java] ---- @Bean -public VectorStore vectorStore(Client client, EmbeddingClient embeddingClient) { +public VectorStore vectorStore(Client client, EmbeddingModel embeddingModel) { TypesenseVectorStoreConfig config = TypesenseVectorStoreConfig.builder() .withCollectionName("test_vector_store") - .withEmbeddingDimension(embeddingClient.dimensions()) + .withEmbeddingDimension(embeddingModel.dimensions()) .build(); - return new TypesenseVectorStore(client, embeddingClient, config); + return new TypesenseVectorStore(client, embeddingModel, config); } @Bean diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/weaviate.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/weaviate.adoc index edcead796..9a163519d 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/weaviate.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/weaviate.adoc @@ -14,7 +14,7 @@ It provides tools to store document embeddings, content, and metadata and to sea - `Transformers Embedding` - computes the embedding in your local environment. Follow the ONNX Transformers Embedding instructions. - `OpenAI Embedding` - uses the OpenAI embedding endpoint. You need to create an account at link:https://platform.openai.com/signup[OpenAI Signup] and generate the api-key token at link:https://platform.openai.com/account/api-keys[API Keys]. -- You can also use the `Azure OpenAI Embedding` or the `PostgresML Embedding Client`. +- You can also use the `Azure OpenAI Embedding` or the `PostgresML Embedding Model`. 2. `Weaviate cluster`. You can set up a cluster locally in a Docker container or create a link:https://console.weaviate.cloud/[Weaviate Cloud Service]. For the latter, you need to create a Weaviate account, set up a cluster, and get your access API key from the link:https://console.weaviate.cloud/dashboard[dashboard details]. On startup, the `WeaviateVectorStore` creates the required `SpringAiWeaviate` object schema if it's not already provisioned. diff --git a/spring-ai-spring-boot-autoconfigure/pom.xml b/spring-ai-spring-boot-autoconfigure/pom.xml index 260691f42..12032b493 100644 --- a/spring-ai-spring-boot-autoconfigure/pom.xml +++ b/spring-ai-spring-boot-autoconfigure/pom.xml @@ -69,7 +69,7 @@ true - + org.springframework.ai spring-ai-transformers diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingAutoConfiguration.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingAutoConfiguration.java index 82b6292de..dabc8126e 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingAutoConfiguration.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; /** - * {@link AutoConfiguration Auto-configuration} for Bedrock Cohere Embedding Client. + * {@link AutoConfiguration Auto-configuration} for Bedrock Cohere Embedding Model. * * @author Christian Tzolov * @author Wei Jiang diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingProperties.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingProperties.java index 77b1677bd..8e6327941 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingProperties.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/cohere/BedrockCohereEmbeddingProperties.java @@ -34,7 +34,7 @@ public class BedrockCohereEmbeddingProperties { public static final String CONFIG_PREFIX = "spring.ai.bedrock.cohere.embedding"; /** - * Enable Bedrock Cohere Embedding Client. False by default. + * Enable Bedrock Cohere Embedding Model. False by default. */ private boolean enabled = false; diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingAutoConfiguration.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingAutoConfiguration.java index b019dc1c6..bfca436bf 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingAutoConfiguration.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; /** - * {@link AutoConfiguration Auto-configuration} for Bedrock Titan Embedding Client. + * {@link AutoConfiguration Auto-configuration} for Bedrock Titan Embedding Model. * * @author Christian Tzolov * @author Wei Jiang diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingProperties.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingProperties.java index 9d9b1bd6e..5136d7575 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingProperties.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/titan/BedrockTitanEmbeddingProperties.java @@ -31,7 +31,7 @@ public class BedrockTitanEmbeddingProperties { public static final String CONFIG_PREFIX = "spring.ai.bedrock.titan.embedding"; /** - * Enable Bedrock Titan Embedding Client. False by default. + * Enable Bedrock Titan Embedding Model. False by default. */ private boolean enabled = false; diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/transformers/TransformersEmbeddingModelProperties.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/transformers/TransformersEmbeddingModelProperties.java index 0c0344eaf..2ffc590be 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/transformers/TransformersEmbeddingModelProperties.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/transformers/TransformersEmbeddingModelProperties.java @@ -43,7 +43,7 @@ public class TransformersEmbeddingModelProperties { .getAbsolutePath(); /** - * Enable the Transformer Embedding client. + * Enable the Transformer Embedding model. */ private boolean enabled = true; diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfiguration.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfiguration.java index f16a04df8..6df56dea6 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfiguration.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfiguration.java @@ -34,7 +34,7 @@ public class TypesenseVectorStoreAutoConfiguration { @Bean @ConditionalOnMissingBean - public VectorStore vectorStore(Client typesenseClient, EmbeddingModel embeddingClient, + public TypesenseVectorStore vectorStore(Client typesenseClient, EmbeddingModel embeddingModel, TypesenseVectorStoreProperties properties) { TypesenseVectorStoreConfig config = TypesenseVectorStoreConfig.builder() @@ -42,7 +42,7 @@ public class TypesenseVectorStoreAutoConfiguration { .withEmbeddingDimension(properties.getEmbeddingDimension()) .build(); - return new TypesenseVectorStore(typesenseClient, embeddingClient, config); + return new TypesenseVectorStore(typesenseClient, embeddingModel, config); } @Bean diff --git a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfigurationIT.java b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfigurationIT.java index b6c937f96..df89b624d 100644 --- a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfigurationIT.java +++ b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/typesense/TypesenseVectorStoreAutoConfigurationIT.java @@ -98,7 +98,7 @@ public class TypesenseVectorStoreAutoConfigurationIT { static class Config { @Bean - public EmbeddingModel embeddingClient() { + public EmbeddingModel embeddingModel() { return new TransformersEmbeddingModel(); } diff --git a/spring-ai-spring-boot-docker-compose/pom.xml b/spring-ai-spring-boot-docker-compose/pom.xml index c72cc1165..1728041dd 100644 --- a/spring-ai-spring-boot-docker-compose/pom.xml +++ b/spring-ai-spring-boot-docker-compose/pom.xml @@ -59,7 +59,7 @@ true - + org.springframework.ai spring-ai-transformers diff --git a/spring-ai-spring-boot-testcontainers/pom.xml b/spring-ai-spring-boot-testcontainers/pom.xml index e282291ae..804a5c880 100644 --- a/spring-ai-spring-boot-testcontainers/pom.xml +++ b/spring-ai-spring-boot-testcontainers/pom.xml @@ -59,7 +59,7 @@ true - + org.springframework.ai spring-ai-transformers diff --git a/vector-stores/spring-ai-cassandra-store/src/main/java/org/springframework/ai/vectorstore/CassandraVectorStore.java b/vector-stores/spring-ai-cassandra-store/src/main/java/org/springframework/ai/vectorstore/CassandraVectorStore.java index 974c0ab50..2f4e138eb 100644 --- a/vector-stores/spring-ai-cassandra-store/src/main/java/org/springframework/ai/vectorstore/CassandraVectorStore.java +++ b/vector-stores/spring-ai-cassandra-store/src/main/java/org/springframework/ai/vectorstore/CassandraVectorStore.java @@ -127,7 +127,7 @@ public class CassandraVectorStore implements VectorStore, AutoCloseable { public CassandraVectorStore(CassandraVectorStoreConfig conf, EmbeddingModel embeddingModel) { Preconditions.checkArgument(null != conf, "Config must not be null"); - Preconditions.checkArgument(null != embeddingModel, "Embedding client must not be null"); + Preconditions.checkArgument(null != embeddingModel, "Embedding model must not be null"); this.conf = conf; this.embeddingModel = embeddingModel; diff --git a/vector-stores/spring-ai-neo4j-store/src/main/java/org/springframework/ai/vectorstore/Neo4jVectorStore.java b/vector-stores/spring-ai-neo4j-store/src/main/java/org/springframework/ai/vectorstore/Neo4jVectorStore.java index 1ea0a913a..c5e546e6f 100644 --- a/vector-stores/spring-ai-neo4j-store/src/main/java/org/springframework/ai/vectorstore/Neo4jVectorStore.java +++ b/vector-stores/spring-ai-neo4j-store/src/main/java/org/springframework/ai/vectorstore/Neo4jVectorStore.java @@ -280,7 +280,7 @@ public class Neo4jVectorStore implements VectorStore, InitializingBean { this.initializeSchema = initializeSchema; Assert.notNull(driver, "Neo4j driver must not be null"); - Assert.notNull(embeddingModel, "Embedding client must not be null"); + Assert.notNull(embeddingModel, "Embedding model must not be null"); this.driver = driver; this.embeddingModel = embeddingModel; diff --git a/vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/RedisVectorStore.java b/vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/RedisVectorStore.java index 0dd181a73..e28589618 100644 --- a/vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/RedisVectorStore.java +++ b/vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/RedisVectorStore.java @@ -290,7 +290,7 @@ public class RedisVectorStore implements VectorStore, InitializingBean { public RedisVectorStore(RedisVectorStoreConfig config, EmbeddingModel embeddingModel, boolean initializeSchema) { Assert.notNull(config, "Config must not be null"); - Assert.notNull(embeddingModel, "Embedding client must not be null"); + Assert.notNull(embeddingModel, "Embedding model must not be null"); this.initializeSchema = initializeSchema; this.jedis = new JedisPooled(config.uri); diff --git a/vector-stores/spring-ai-typesense-store/src/main/java/org/springframework/ai/vectorstore/TypesenseVectorStore.java b/vector-stores/spring-ai-typesense-store/src/main/java/org/springframework/ai/vectorstore/TypesenseVectorStore.java index 45dd233eb..c9e96cd8f 100644 --- a/vector-stores/spring-ai-typesense-store/src/main/java/org/springframework/ai/vectorstore/TypesenseVectorStore.java +++ b/vector-stores/spring-ai-typesense-store/src/main/java/org/springframework/ai/vectorstore/TypesenseVectorStore.java @@ -50,7 +50,7 @@ public class TypesenseVectorStore implements VectorStore, InitializingBean { private final Client client; - private final EmbeddingModel embeddingClient; + private final EmbeddingModel embeddingModel; private final TypesenseVectorStoreConfig config; @@ -126,16 +126,16 @@ public class TypesenseVectorStore implements VectorStore, InitializingBean { } - public TypesenseVectorStore(Client client, EmbeddingModel embeddingClient) { - this(client, embeddingClient, TypesenseVectorStoreConfig.defaultConfig()); + public TypesenseVectorStore(Client client, EmbeddingModel embeddingModel) { + this(client, embeddingModel, TypesenseVectorStoreConfig.defaultConfig()); } - public TypesenseVectorStore(Client client, EmbeddingModel embeddingClient, TypesenseVectorStoreConfig config) { + public TypesenseVectorStore(Client client, EmbeddingModel embeddingModel, TypesenseVectorStoreConfig config) { Assert.notNull(client, "Typesense must not be null"); - Assert.notNull(embeddingClient, "EmbeddingClient must not be null"); + Assert.notNull(embeddingModel, "EmbeddingModel must not be null"); this.client = client; - this.embeddingClient = embeddingClient; + this.embeddingModel = embeddingModel; this.config = config; } @@ -148,7 +148,7 @@ public class TypesenseVectorStore implements VectorStore, InitializingBean { typesenseDoc.put(DOC_ID_FIELD_NAME, document.getId()); typesenseDoc.put(CONTENT_FIELD_NAME, document.getContent()); typesenseDoc.put(METADATA_FIELD_NAME, document.getMetadata()); - List embedding = this.embeddingClient.embed(document.getContent()); + List embedding = this.embeddingModel.embed(document.getContent()); typesenseDoc.put(EMBEDDING_FIELD_NAME, embedding); return typesenseDoc; @@ -201,7 +201,7 @@ public class TypesenseVectorStore implements VectorStore, InitializingBean { logger.info("Filter expression: {}", nativeFilterExpressions); - List embedding = this.embeddingClient.embed(request.getQuery()); + List embedding = this.embeddingModel.embed(request.getQuery()); MultiSearchCollectionParameters multiSearchCollectionParameters = new MultiSearchCollectionParameters(); multiSearchCollectionParameters.collection(this.config.collectionName); @@ -249,13 +249,13 @@ public class TypesenseVectorStore implements VectorStore, InitializingBean { return this.config.embeddingDimension; } try { - int embeddingDimensions = this.embeddingClient.dimensions(); + int embeddingDimensions = this.embeddingModel.dimensions(); if (embeddingDimensions > 0) { return embeddingDimensions; } } catch (Exception e) { - logger.warn("Failed to obtain the embedding dimensions from the embedding client and fall backs to default:" + logger.warn("Failed to obtain the embedding dimensions from the embedding model and fall backs to default:" + this.config.embeddingDimension, e); } return OPENAI_EMBEDDING_DIMENSION_SIZE; diff --git a/vector-stores/spring-ai-typesense-store/src/test/java/org/springframework/ai/vectorstore/TypesenseVectorStoreIT.java b/vector-stores/spring-ai-typesense-store/src/test/java/org/springframework/ai/vectorstore/TypesenseVectorStoreIT.java index 952458ea6..6daf6b72f 100644 --- a/vector-stores/spring-ai-typesense-store/src/test/java/org/springframework/ai/vectorstore/TypesenseVectorStoreIT.java +++ b/vector-stores/spring-ai-typesense-store/src/test/java/org/springframework/ai/vectorstore/TypesenseVectorStoreIT.java @@ -241,14 +241,14 @@ public class TypesenseVectorStoreIT { public static class TestApplication { @Bean - public VectorStore vectorStore(Client client, EmbeddingModel embeddingClient) { + public VectorStore vectorStore(Client client, EmbeddingModel embeddingModel) { TypesenseVectorStoreConfig config = TypesenseVectorStoreConfig.builder() .withCollectionName("test_vector_store") - .withEmbeddingDimension(embeddingClient.dimensions()) + .withEmbeddingDimension(embeddingModel.dimensions()) .build(); - return new TypesenseVectorStore(client, embeddingClient, config); + return new TypesenseVectorStore(client, embeddingModel, config); } @Bean @@ -262,7 +262,7 @@ public class TypesenseVectorStoreIT { } @Bean - public EmbeddingModel embeddingClient() { + public EmbeddingModel embeddingModel() { return new TransformersEmbeddingModel(); }