Set embeddings on added Document objects for Milvus and PgVector stores.
This commit is contained in:
committed by
Mark Pollack
parent
6931148377
commit
867bd173e5
@@ -272,7 +272,7 @@ public class MilvusVectorStore implements VectorStore, InitializingBean {
|
||||
|
||||
for (Document document : documents) {
|
||||
List<Double> embedding = this.embeddingModel.embed(document);
|
||||
|
||||
document.setEmbedding(embedding);
|
||||
docIdArray.add(document.getId());
|
||||
// Use a (future) DocumentTextLayoutFormatter instance to extract
|
||||
// the content used to compute the embeddings
|
||||
|
||||
@@ -166,7 +166,9 @@ public class PgVectorStore implements VectorStore, InitializingBean {
|
||||
var document = documents.get(i);
|
||||
var content = document.getContent();
|
||||
var json = toJson(document.getMetadata());
|
||||
var pGvector = new PGvector(toFloatArray(embeddingModel.embed(document)));
|
||||
var embedding = embeddingModel.embed(document);
|
||||
document.setEmbedding(embedding);
|
||||
var pGvector = new PGvector(toFloatArray(embedding));
|
||||
|
||||
StatementCreatorUtils.setParameterValue(ps, 1, SqlTypeValue.TYPE_UNKNOWN,
|
||||
UUID.fromString(document.getId()));
|
||||
|
||||
Reference in New Issue
Block a user