Find answers from the community

Updated 8 months ago

Metadta

Hey @Logan M, I have a bunch of English explanations of our code base and instead of storing the embeddings of the code base itself, I store the English explanation of the code and embed that. At the same time I store the code snippets as metadata in the Document under the metadata key called “code”. My question: how do I retrieve the corresponding code snippets in that metadata along with the explanation text during retrieval and context setting during synthesizing LLM prompt?
Thanks !
L
c
7 comments
The metadata is already included with the text, unless you explicitly disabled that
Thanks @Logan M I’m not seeing it for some reason. How would you debug and print out all the calls ? The global set handler “simple” is not outputting anything for me.
It really should be outputting lol

But you can debug by doing

Plain Text
retriever = index.as_retriever(...)

nodes = retriever.retrieve("query")

for node in nodes:
    print(node.node.get_content(metadata_mode="llm"))
Whatever gets printed there is what goes into the prompt template sent to the llm
The query engine runs basically exactly that under the hood, before passing it to the response synthesizer
OK thanks, let me run this and I’ll let you know
@Logan M thanks, you were right about this, I had to set some instrument observers to check this.
Add a reply
Sign up and join the conversation on Discord