@ -467,6 +467,13 @@ class Weaviate(VectorStore):
embeddings = embedding . embed_documents ( texts ) if embedding else None
embeddings = embedding . embed_documents ( texts ) if embedding else None
attributes = list ( metadatas [ 0 ] . keys ( ) ) if metadatas else None
attributes = list ( metadatas [ 0 ] . keys ( ) ) if metadatas else None
# If the UUID of one of the objects already exists
# then the existing object will be replaced by the new object.
if " uuids " in kwargs :
uuids = kwargs . pop ( " uuids " )
else :
uuids = [ get_valid_uuid ( uuid4 ( ) ) for _ in range ( len ( texts ) ) ]
with client . batch as batch :
with client . batch as batch :
for i , text in enumerate ( texts ) :
for i , text in enumerate ( texts ) :
data_properties = {
data_properties = {
@ -476,12 +483,7 @@ class Weaviate(VectorStore):
for key in metadatas [ i ] . keys ( ) :
for key in metadatas [ i ] . keys ( ) :
data_properties [ key ] = metadatas [ i ] [ key ]
data_properties [ key ] = metadatas [ i ] [ key ]
# If the UUID of one of the objects already exists
_id = uuids [ i ]
# then the existing objectwill be replaced by the new object.
if " uuids " in kwargs :
_id = kwargs [ " uuids " ] [ i ]
else :
_id = get_valid_uuid ( uuid4 ( ) )
# if an embedding strategy is not provided, we let
# if an embedding strategy is not provided, we let
# weaviate create the embedding. Note that this will only
# weaviate create the embedding. Note that this will only