Find answers from the community

Updated 11 months ago

Hi! Is possible to format the text of

At a glance

The community member posted a question about formatting the text of the context used in a prompt, and wanting to add information for each context retrieved. The comments suggest using a custom node-postprocessor to adjust the text content of each node retrieved, and provide a link to the relevant documentation. Another community member confirms that it is possible to remove the location path from the context and leave only the text by setting node.excluded_llm_metadata_keys. There is no explicitly marked answer.

Useful resources
Hi! Is possible to format the text of context that used in prompt? I want to add a information for each context retrieved
L
M
4 comments
Sounds like a good use case for a custom node-postprocessor, and adjust the text content of each node retrieved?

https://docs.llamaindex.ai/en/stable/module_guides/querying/node_postprocessors/#custom-node-postprocessor

index.as_query_engine(...., node_postprocessors=[my_postprocessor])
When I used set_global_handler I noticed that the context comes with the location path. Is it possible to remove this and leave only the context text recovered?
yes. On the nodes/documents, you can set node.excluded_llm_metadata_keys = ["key1", ...]
Add a reply
Sign up and join the conversation on Discord