Find answers from the community

Updated 5 months ago

I'm trying out a recursive retriever

At a glance
I'm trying out a recursive retriever using metadata as shown in this tutorial: https://docs.llamaindex.ai/en/stable/examples/retrievers/recursive_retriever_nodes.html#metadata-references-summaries-generated-questions-referring-to-a-bigger-chunk

But I"m getting an error:

Plain Text
    text=d["questions_this_excerpt_can_answer"],
         ~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'questions_this_excerpt_can_answer'


Here's my code:

Plain Text
    extractors = [
        SummaryExtractor(summaries=["self"], show_progress=True, llm=llm),
        QuestionsAnsweredExtractor(questions=5, show_progress=True, llm=llm),
    ]

    metadata_dicts = []
    for extractor in extractors:
        metadata_dicts.extend(extractor.extract(nodes))

    all_nodes = copy.deepcopy(nodes)
    for idx, d in enumerate(metadata_dicts):
        inode_q = IndexNode(
            text=d["questions_this_excerpt_can_answer"],
            index_id=nodes[idx].node_id,
        )
        inode_s = IndexNode(text=d["section_summary"], index_id=nodes[idx].node_id)
        all_nodes.extend([inode_q, inode_s])
k
F
2 comments
I guess SummaryExtractor will have "section_summary" and QuestionsAnsweredExtractor will have "questions_this_excerpt_can_answer"
Hey, i got the same error, i switched the keys too, but i still get a error for 'questions_this_excerpt_can_answer'
Add a reply
Sign up and join the conversation on Discord