retriever.retrieve(question)
and there are always chunks returnedfrom llama_index import SimpleDirectoryReader, VectorStoreIndex from llama_index.indices.postprocessor import SimilarityPostprocessor documents = SimpleDirectoryReader("./paul_graham").load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine( node_postprocessors=[ SimilarityPostprocessor(similarity_cutoff=0.8) ] ) retriever = index.as_retriever() # set a breakpoint to inspect import pdb pdb.set_trace() nodes = retriever.retrieve("What did the author do growing up?") response = query_engine.query("What did the author do growing up?") print("Done!")
embedding=None
1-distance/2 is certainty
(normalised distance on a scale of 0-1) and from here https://weaviate.io/developers/weaviate/more-resources/faq#q-how-do-i-get-the-cosine-similarity-from-weaviates-certainty cosine_sim = 2*certainty - 1
(if you replace certainty here with 1-distance/2) you'll get 1-distance (this is my interpretation tho π
) 2 * certainty - 1
1-distance