RAG is working, but how to directly query an FAISS knowledge bank?

Neil_B
Level 3
RAG is working, but how to directly query an FAISS knowledge bank?

Hi All,

We're currently running version 12.3.2 and have had some good success setting up an LLM flow using the public preview recipes.  I've got a corpus of text going through the embeddings recipe and generating an FAISS knowledge bank.  I've been able to use retrieval augmented generation against the knowledge bank using a prompt recipe.  All of this is working great. 

What I'd like to understand is, how can I simply query against this knowledge bank for nearest neighbors?  I know that when i run the prompt recipe, the 5 nearest neighbors are being retrieved and passed to the LLM as context, and are also cited in the output.  If I have a new text string and simply want to retrieve and output the 5 nearest neighbors and their associated document chunks from the knowledge bank, without passing them back to the LLM as part of a prompt, how can I do this?  Can anyone provide a python example? 

Additionally, for the dataiku folks, will we eventually have another recipe allowing us to do this?

0 Kudos
2 Replies
AgatheG
Dataiker

Hi Neil,

You might want to have a look at the API reference page for LLM Mesh, more precisely on the KnowledgeBank & associated methods: https://developer.dataiku.com/latest/api-reference/python/llm-mesh.html#dataiku.KnowledgeBank

 

Hope that helps!

 

Agathe

0 Kudos
Neil_B
Level 3
Author

Thanks for the link.  I looked there first before posting, and the section of the documentation in question seems to have been greatly enhanced since I posted my question.  That definitely gives me what I need now, thank you.

 

-Neil