Find answers from the community

Updated last year

Faiss embeddings

Any way to get the raw embeddings of retrieved nodes (not just indices + similarities as pictured) when using faiss vectorstore?
Or a hack/workaround to get the raw embeddings here?

example of my current retrieval code:

Plain Text
    from llama_index.vector_stores.types import VectorStoreQuery
      vsq = VectorStoreQuery(query_embedding=item.query_embedding, similarity_top_k=item.num_results, output_fields=['embeddings'])
      query_result = index.vector_store.query(query=vsq)
      return query_result
    

and:

Plain Text
 x = await index.as_retriever(similarity_top_k=num_results_to_retrieve).aretrieve(QueryBundle("not used", embedding=item.query_embedding))



Looking make clusters from my index, and to create the clusters i need the raw embeddings
Attachment
image.png
L
B
3 comments
You might have to use faiss directly?

Although I'm not even sure if it returns embeddings. The vector store source code doesn't seem to indicate that anyways

https://github.com/run-llama/llama_index/blob/8043613e0aadcb6d5fffd4f1dc466f911088ac73/llama_index/vector_stores/faiss.py#L169
@Logan M right on, works with using faiss directly:

thanks
Attachment
image.png
actually simpler this way here hah
Attachment
image.png
Add a reply
Sign up and join the conversation on Discord