from time import monotonic, sleep from qdrant_client import QdrantClient, models from sentence_transformers import SentenceTransformer qdrant_url = "http://localhost:6333" collection_name = "sentence_transformers_support_docs" expected_points = 512 query = "How can I reset a forgotten account password?" corpus = [ { "doc_id": "doc-000", "title": "Reset a forgotten password", "text": "Reset a forgotten account password from account settings and confirm the recovery email.", } ] corpus.extend( { "doc_id": f"doc-{point_id:03d}", "title": f"Archive retention record {point_id:03d}", "text": ( f"Archive record {point_id:03d} describes retention schedules, " "storage labels, and routine document review." ), } for point_id in range(1, expected_points) ) model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2") document_embeddings = model.encode_document( [item["text"] for item in corpus], normalize_embeddings=True, convert_to_numpy=True, show_progress_bar=False, ) vector_size = document_embeddings.shape[1]