You can enrich each retrieved segment with metadata before sending to the LLM to generate the answer.
- Go to the Processing view
- Press CTRL + double click on “Kairntech” at the bottom of the UI

- A new component “Question context generators” will be displayed

- Create a new “Question context generator” from the default configuration
- The “jinja” component will be displayed

- Edit the jinja template to address your needs
- You can add a metadata in each and every retrieved segments before sending them to the LLM to generate the answer.
- In the example below, we enrich the top 10 retrieved segments with the metadata Publication date, Article date and Topic.
{% set loop_index = 0 -%}
{% for hit in hits[:10] -%}
{% set loop_index = loop_index + 1 -%}
{{ loop_index }}.
Publication date: {{ hit.segment.metadata["PUBLICATION DATE"] }}
Article date: {{ hit.segment.metadata["ARTICLE DATE"] }}
Topic: {{ hit.segment.metadata["TOPIC"] }}
Text: {{ hit.segment.text | replace("\n", " ") }}
{% endfor -%}

- Mark your Question context generator as favorite
- Now you can ask a question for instance for a Topic AND a Publication date
