Skip to content

Commit cae045d

Browse files
michaelsembwevertzolov
authored andcommitted
Add the autoconfigure property for the CassandraVectorStore option to return embeddings in documents from similarity searches
ref: #673
1 parent 5beef21 commit cae045d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/cassandra/CassandraVectorStoreAutoConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public CassandraVectorStore vectorStore(EmbeddingClient embeddingClient, Cassand
5757
if (properties.getDisallowSchemaCreation()) {
5858
builder = builder.disallowSchemaChanges();
5959
}
60+
if (properties.getReturnEmbeddings()) {
61+
builder = builder.returnEmbeddings();
62+
}
6063

6164
return new CassandraVectorStore(builder.build(), embeddingClient);
6265
}

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/cassandra/CassandraVectorStoreProperties.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class CassandraVectorStoreProperties {
4141

4242
private boolean disallowSchemaChanges = false;
4343

44+
private boolean returnEmbeddings = false;
45+
4446
private int fixedThreadPoolExecutorSize = CassandraVectorStoreConfig.DEFAULT_ADD_CONCURRENCY;
4547

4648
public String getKeyspace() {
@@ -83,14 +85,22 @@ public void setEmbeddingColumnName(String embeddingColumnName) {
8385
this.embeddingColumnName = embeddingColumnName;
8486
}
8587

86-
public Boolean getDisallowSchemaCreation() {
88+
public boolean getDisallowSchemaCreation() {
8789
return this.disallowSchemaChanges;
8890
}
8991

9092
public void setDisallowSchemaCreation(boolean disallowSchemaCreation) {
9193
this.disallowSchemaChanges = disallowSchemaCreation;
9294
}
9395

96+
public boolean getReturnEmbeddings() {
97+
return this.returnEmbeddings;
98+
}
99+
100+
public void setReturnEmbeddings(boolean returnEmbeddings) {
101+
this.returnEmbeddings = returnEmbeddings;
102+
}
103+
94104
public int getFixedThreadPoolExecutorSize() {
95105
return this.fixedThreadPoolExecutorSize;
96106
}

0 commit comments

Comments
 (0)