Skip to content

Enhance Email Indexation Metadata for RAG Source Recognition #1974

@AlaeMghirbi

Description

@AlaeMghirbi

Why

Currently, the Cozy front-end can only display Cozy Files as sources for the AI assistant when generating responses using RAG .

However, when the AI assistant uses an email as a source, the front-end doesn’t have enough information about the email to recognize or display it properly.

To improve this, we want to send the necessary email information during the indexation phase so that later the Cozy front-end will be able to:

  • Recognize indexed emails as RAG sources.
  • Display them properly.
  • Provide a way to redirect users to the original email mentioned in the source.

What

We focus on sending the required metadata to the Cozy indexation database.

We need to send detailed information about the email, including:

  • Date
  • Subject
  • Sender
  • Recipient
  • **Email preview **

We also need to provide enough metadata to allow Cozy Mail to later build a redirection link to the corresponding email.
For this, we must include the emailId in the indexed metadata.


How

When indexing an email, the TMail backend currently sends basic metadata such as the date and document type through the following method:

computeMetaData located in tmail-backend/tmail-third-party/ai-bot/src/main/java/com/linagora/tmail/mailet/rag/RagListener.java

We need to update this method to include the following additional metadata fields:

  • email subject
  • email sender
  • email recipient
  • email preview

To enable reliable redirection to the corresponding email in the Cozy front-end, we must also:

  • Include the emailId in the metadata or even replace the current usage of messageId (currently used as the name of the indexed email) with emailId, since messageId will no longer be required later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions