Open
Description
QuestionAnswerAdvisor only inserts the contents of the Documents into the prompt. It would be helpful to be able to include the document id and metadata.
When inserting Documents into a PromptTemplate, the object's .toString()
method is automatically, used which includes the id and metadata.
return "Document{id='" + this.id + "', metadata=" + this.metadata + ", content='" + this.content + "', media=" + this.media + "}";
However, with QuestionAnswerAdvisor, it's only possible to include the content:
String documentContext =(String)documents.stream().map(Content::getContent).collect(Collectors.joining(System.lineSeparator()));
It is frequently useful to include the Document id as well as the Document metadata in the prompt so the LLM can use that information. So, it would be helpful if there were a way to tell QAA to include that information.
For the time-being, I'm using a simple hack to make it happen:
Document tempDoc = new Document(uri, text, metadata);
return new Document(uri, tempDoc.toString(), metadata);