Display Vector data leveraged for Embeddings with RetoolAI

I am compiling a vector database of industry specific data. I have licenses to reuse copyrighted material which is stored as a resource in my Vector DB. The Vector db is leveraged to include embeddings to improve the quality of interactions with an AI chatbot. I would like to give credit to the source material leveraged from the Vector db which is sent to the LLM, OpenAI model 4.0, and include this information in a view for the user to appropriately cite the source. I do not know if this datapoint is exposed anywhere conveniently to display in my app. Any insight or tips would be appreciated!

Hello @Laith_Charles! I am an engineer on the Retool team.

This is a great question. In the Retool AI query editor, if you check Use Retool Vectors to provide more context to your query you'll automatically include vector context to your AI query. Now, getting back to your question, if you want to cite the vector source that the LLM uses, you can find the sources (list in order of importance) by programmatically accessing {{ queryName.metadata.vectorContext }}. For each source, you can even see a similarity score, which quantifies how important that source was to the LLM! See below.


Thanks for the quick and detailed reply! For some reason I was expecting this to be in an input versus an "Output". But that worked like a charm. The data is easy to display in a table, I added an index column by creating a custom column with {{i+1}} otherwise your command did the trick and it was intuitive to setup all of the columns.


I'd love to see an example of the outcome /output.... I'm looking for inspiration for a similar example.