Skip to content

Commit

Permalink
Changes in existing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarraann committed Jul 18, 2023
1 parent ba58726 commit 87060b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion superagi/vector_store/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def add_texts(
metadata[self.text_field] = text
vectors.append((id, self.embedding_model.get_embedding(text), metadata))

self.index.upsert(vectors, namespace=namespace, batch_size=batch_size)
self.add_embeddings_to_vector_db({"vectors": vectors})
return ids

def get_matching_text(self, query: str, top_k: int = 5, metadata: Optional[dict] = {}, **kwargs: Any) -> List[Document]:
Expand Down
21 changes: 7 additions & 14 deletions superagi/vector_store/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,14 @@ def add_texts(
text_batch = input_texts[i * batch_limit: (i + 1) * batch_limit]
metadata_batch = metadata_list[i * batch_limit: (i + 1) * batch_limit] or None
id_batch = id_list[i * batch_limit: (i + 1) * batch_limit]

self.client.upsert(
collection_name=self.collection_name,
points=models.Batch.construct(
ids=id_batch,
vectors=self.__get_embeddings(text_batch),
payloads=self.__build_payloads(
text_batch,
metadata_batch,
self.text_field_payload_key,
self.metadata_payload_key,
),
),
vectors = self.__get_embeddings(text_batch)
payloads = self.__build_payloads(
text_batch,
metadata_batch,
self.text_field_payload_key,
self.metadata_payload_key,
)

self.add_embeddings_to_vector_db({"ids": id_batch, "vectors": vectors, "payloads": payloads})
collected_ids.extend(id_batch)

return collected_ids
Expand Down

0 comments on commit 87060b7

Please sign in to comment.