Hi all, I'm using CitationQueryEngine to provide citations in my responses. On my UI, I want to be able to hover over a citation (e.g. [2]) and display links to the relevant part of each source.
Using response.source_nodes, what is the best way to know which source belongs to which citation? The text field contains the citation number (e.g. "Source 2: blah blah"), but I would have to parse this to extract the citation number.
I can't see any other field that just has the citation number itself. Is there one?
The other question I have about CitationQueryEngine is that I want to use it in a chat context with history (i.e. index.as_chat_engine()). Is there a simple way to do this? There doesn't seem to be a way to pass the query engine into as_chat_engine().
I did end up getting something working with CitationQueryEngine by looking at the implementation of as_chat_engine() and constructing a tool from the query engine, but it feels a bit hacky as I then had to reach into the response and get the raw response from the tool. So I'll give your suggestion a whirl. Thanks again.