Rename all Embedding Client doc and variables occurrences into Embedding Model

This commit is contained in:
Christian Tzolov
2024-06-16 21:24:03 +02:00
parent 704dec20d9
commit 958549ecce
35 changed files with 70 additions and 70 deletions

View File

@@ -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

View File

@@ -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
*/

View File

@@ -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

View File

@@ -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:

View File

@@ -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]

View File

@@ -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]

View File

@@ -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]
----

View File

@@ -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]
----

View File

@@ -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]
----

View File

@@ -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]
----

View File

@@ -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]

View File

@@ -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

View File

@@ -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]
----

View File

@@ -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]

View File

@@ -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]
----

View File

@@ -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]
----

View File

@@ -68,7 +68,7 @@ Add these dependencies to your project:
</dependency>
----
* 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]
----

View File

@@ -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]

View File

@@ -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

View File

@@ -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.

View File

@@ -69,7 +69,7 @@
<optional>true</optional>
</dependency>
<!-- Transformers Embedding Client -->
<!-- Transformers Embedding Model -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-transformers</artifactId>

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -43,7 +43,7 @@ public class TransformersEmbeddingModelProperties {
.getAbsolutePath();
/**
* Enable the Transformer Embedding client.
* Enable the Transformer Embedding model.
*/
private boolean enabled = true;

View File

@@ -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

View File

@@ -98,7 +98,7 @@ public class TypesenseVectorStoreAutoConfigurationIT {
static class Config {
@Bean
public EmbeddingModel embeddingClient() {
public EmbeddingModel embeddingModel() {
return new TransformersEmbeddingModel();
}

View File

@@ -59,7 +59,7 @@
<optional>true</optional>
</dependency>
<!-- Transformers Embedding Client -->
<!-- Transformers Embedding Model -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-transformers</artifactId>

View File

@@ -59,7 +59,7 @@
<optional>true</optional>
</dependency>
<!-- Transformers Embedding Client -->
<!-- Transformers Embedding Model -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-transformers</artifactId>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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<Double> embedding = this.embeddingClient.embed(document.getContent());
List<Double> 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<Double> embedding = this.embeddingClient.embed(request.getQuery());
List<Double> 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;

View File

@@ -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();
}