Find answers from the community

Updated last year

Response synthesizers

At a glance
Hi - I'm trying to understand the different types of nodes in llama_index.
I have a set of nodes coming from SentenceSplitter and I'm trying to synthesize using get_response_synthesizer:
Plain Text
query = "<query>"
nodes = SentenceSplitter().get_nodes_from_documents(documents)
synthesizer = get_response_synthesizer(response_mode="compact")
synthesizer.synthesize(query, nodes)

This gives me the error:
Plain Text
AttributeError: 'TextNode' object has no attribute 'node'

Does anyone know why is this error happening?
L
e
2 comments
It's expecting a list of NodeWithScore objects (the output of a retriever)

Plain Text
from llama_index.schema import NodeWithScore

NodeWithScore(node=node, score=1.0)


Instead of synthesize, you could also use synthesizer.get_response(), which takes in a list of strings
That worked, thanks Logan!
Add a reply
Sign up and join the conversation on Discord