You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defadd_user_metadata(username, chunks):
forchunkinchunks:
chunk.metadata["username"] =usernamereturnchunksdefembed_documents(chunks):
try:
vectorstore=AzureCosmosDBVectorSearch.from_documents(
chunks,
embedding_model,
collection=collection,
index_name=INDEX_NAME,
embedding_key=embedding_key,
)
# Create index if not yet createdifvectorstore.index_exists() isFalse:
num_lists=100dimensions=1536similarity_algorithm=CosmosDBSimilarityType.COSkind=CosmosDBVectorSearchType.VECTOR_IVFm=16ef_construction=64vectorstore.create_index(
num_lists, dimensions, similarity_algorithm, kind, m, ef_construction
)
returnTrueexceptExceptionase:
print(f"Error embedding documents: {e}")
returnFalse
Description
I am storing each document chunk in my db, with the a username field in the metadata referring to the user. I want to be able to delete all the documents belonging to a specific user? Do i use the .delete() method for the vectorstore? How can i retrieve the document ids?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Example Code
Description
I am storing each document chunk in my db, with the a username field in the metadata referring to the user. I want to be able to delete all the documents belonging to a specific user? Do i use the .delete() method for the vectorstore? How can i retrieve the document ids?
Beta Was this translation helpful? Give feedback.
All reactions