Skip to content

Commit

Permalink
fix add documents
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisoSouza committed Aug 12, 2024
1 parent d2f39cb commit 85a8e2e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/store/elasticsearch_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ def save(self, docs: list[Document]) -> list[str]:
index = os.environ.get("INDEX_CONTENTBASES_NAME", "content_bases")

if self.vectorstore.client.indices.exists(index=index):
index_documents = self.vectorstore.add_documents
else:
index_documents = self.vectorstore.from_documents

res = index_documents(
return self.vectorstore.add_documents(
docs,
bulk_kwargs={
"chunk_size": os.environ.get("CHILD_CHUNK_SIZE", 225),
"max_chunk_bytes": 200000000
}
)

res = self.vectorstore.from_documents(
docs,
self.vectorstore.embeddings,
es_url=os.environ.get("ELASTICSEARCH_URL"),
Expand Down

0 comments on commit 85a8e2e

Please sign in to comment.