[Intelligence] fix: description and stream history not provided in the context

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhack_jos
    Junior Member
    • Apr 2025
    • 19

    #1

    [Intelligence] fix: description and stream history not provided in the context

    Thank you for the new Intelligence extension, it is a much needed official integration.

    Reading the official documentation for the Email Composer:

    The parent record description and stream history are provided to the AI as context. If the user does not have access to the stream, then the stream history is omitted.
    Description and stream history are supposed to be provided to the AI in the context.
    I did many tests, but no matter what I do, the AI says it only knows the name and surname of the Lead. It openly says it knows nothing about the description or the Steam of the Lead, and it constantly shows no ability to recall this information to compose the email.

    I do have access permission to both the Description and the Steam in the user I am logged in, as such I believe there may be some kind of bug preventing me from using this functionality.

    Having the Lead Description and Stream history would be incredibly helptful: in fact it is thanks to this information that the AI would become really useful.
    I am available to provide any further information to help pin out the problem.
    Warmest Regards,
    Jacopo
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 10036

    #2
    Hi Jacopo,

    I just tested and the Stream history was provided to the LLM in input (you can enable debug mode for the Espo log to see what is provided).

    The Description is currently supported for the Case entity type only. Likely to be extended to supported any entity type.

    Comment


    • yuri
      yuri commented
      Editing a comment
      The Description field is included for Leads (and other entity types) as of v1.1.1.
  • jhack_jos
    Junior Member
    • Apr 2025
    • 19

    #3
    Hi Yuri,

    thank you for releasing so quickly an update, it was very helpful.
    I am glad to confirm that now Intelligence correctly adds the description field to the AI context.

    As you recommended I enabled debug mode, and checked. I got only:
    1) INSTRUCTIONS FOR MESSAGE TO COMPOSE,
    2) DESCRIPTION, and
    3) RECIPIENTS

    I looked into the reason why it seems I can do nothing to get the ACTIVITY HISTORY added to the context, and then I think I understood.
    The Intelligence extension now adds previously sent or received emails only if streamEmailWithContentEntityTypeList is enabled for that entitity.
    In our case, we had the default setting, so only "Case" had this setting on.
    The problem is that even adding streamEmailWithContentEntityTypeList for Lead or Contact now, does not make it work retroactively.

    I think the Intelligence extension should add emails to the ACTIVITY HISTORY even if Note::FIELD_POST . '==' => null.
    It would be especially seamless and user friendly if the NotesProvider would use the emailId in the Note to fetch the email subject and body from db and add it to the ACTIVITY HISTORY for the AI. This would make the extension work "out of the box".

    As an extra, but that's less important, I'd also probably add the name of all Meetings that are in the Stream where the Lead / Contact joined, since it could help better reconstruct the Entity journey. This would make the Email Composer more useful and truly intelligent.

    Thank you in advance for your consideration.
    Warmest Regards,

    Jacopo Tedeschi​

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 10036

      #4
      Hi Jacopo,

      The parameter 'streamEmailWithContentEntityTypeList' is exposed in the UI (Administration > Settings > General > Entities with email body in stream notes).

      I'm not totally sure we need to re-fetch emails. We would need to check access to each email in the loop. We'll consider it later.

      Comment

      • jhack_jos
        Junior Member
        • Apr 2025
        • 19

        #5
        Hi Yuri,

        thank you for your support!
        I enabled streamEmailWithContentEntityTypeList using the UI as you suggested.
        I understand the problem with ACL when re-fetching emails. I still hope re-fetching will be implemented later when Note::FIELD_POST . '==' => null, considering it's convenience.
        In the meanwhile new users may appreciate if this information is added to the Documentation of the Intelligence Extension, in the AI Email Composer paragraph, so to help them correctly setup the ACTIVITY HISTORY for entities that do not have streamEmailWithContentEntityTypeList enabled by default.

        As always, thank you for your consideration!
        Warmest Regards,
        Jacopo Tedeschi

        Comment

        Working...