from llama_index.core import get_response_synthesizer from llama_index.core.llms import MockLLM from llama_index.core.schema import NodeWithScore, TextNode nodes = [ NodeWithScore( node=TextNode(text="Refund requests are handled by the support portal."), score=1.0, ) ] response_synthesizer = get_response_synthesizer( response_mode="compact", llm=MockLLM(max_tokens=None), ) response = response_synthesizer.synthesize( "Where are refund requests handled?", nodes=nodes, ) print(f"response_synthesizer={type(response_synthesizer).__name__}") print(f"contains_context={'support portal' in str(response)}") print(f"source_count={len(response.source_nodes)}")