Multimodal feature for confluence (image summaries only) #3208
+774
−59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds multimodal functionality to the Confluence connector: extracts all images that are in the attachment of a confluence page (and used on the page) and uses a (multimodal) LLM to create textual descriptions/summaries for each image.
To improve the summary the XML of each confluence page is passed to the LLM as well as the title of the page and the name of the image. Each summary is stored as a new document, with the summary as the text of the section and the page of origin as link.
Additional a label that marks the content of the document as a summary (label: is_image_summary) is created to enable users to directly recognise summaries as such.
With this approach, the first multimodal functions can be integrated into the Confluence connector without having to fundamentally adapt the retrieval or general structure of documents in Danswer.
Multimodality can be activated using the environment variable CONFLUENCE_IMAGE_SUMMARIZATION_MULTIMODAL_ANSWERING.
If not used or false nothing will change, meaning no summaries will be generated and used for the answers.
If CONFLUENCE_IMAGE_SUMMARIZATION_MULTIMODAL_ANSWERING is set false after indexing with summaries all summaries will be ignored in retrieval.
Optionally users can set a custom system prompt (CONFLUENCE_IMAGE_SUMMARIZATION_SYSTEM_PROMPT) and user prompt (*
CONFLUENCE_IMAGE_SUMMARIZATION_USER_PROMPT*) as environment variables for the summarization. If not specified otherwise default prompts will be used.
How Has This Been Tested?
Accepted Risk (provide if relevant)
Related Issue(s) (provide if relevant)
N/A
Mental Checklist:
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.