query = 'what should I do if I worked overtime?' | |
question_embedding = bi_encoder.encode(query, convert_to_tensor=True) | |
hits = util.semantic_search(question_embedding, corpus_embeddings, top_k=top_k) | |
hits = [hit for hit in hits[0]] | |
hits = sorted([hit['corpus_id'] for hit in hits]) | |
context = "\n".join([passages[hit] for hit in hits]) |