EF-AI-Co-Finder / get_similar_profiles.py
Adr740's picture
Upload 5 files
ef233f0 verified
raw
history blame
544 Bytes
from ragatouille import RAGPretrainedModel
myrag = RAGPretrainedModel.from_index("ragatouille/colbert/indexes/cofindex_vector_db_nosplit/")
def get_similar_profiles(profile, prefix, rag_engine = myrag, k=20):
query = prefix + profile
raw_results = rag_engine.search(str(query), k=k)
results = []
for result in raw_results:
if result["content"] == profile:
print("ah")
else:
results.append(result["content"])
final_md = ""
for result in results:
final_md += "### " + result[1:]
return final_md