Please answer only with the information given in context: """ Metadata: { "book": "xyz", "page": "3" } This is a chapter on the history of Rome etc { "book": "gef", "page": "374" } This is a chapter on Athens etc ... """ Question: {}
from llama_index.core import set_global_handler set_global_handler("simple")
from llama_index.core.prompts.default_prompt_selectors import DEFAULT_TEXT_QA_PROMPT_SEL # get source nodes nodes = retriever.retrieve(nodes) # or nodes = response.source_nodes context_str = "\n\n".join([n.node.get_content(metadata_mode="llm") for n in nodes]) prompt = DEFAULT_TEXT_QA_PROMPT_SEL.format(llm=llm, context_str=context_str, query_str=query_str) print(prompt)