Hi, yes I’ve actually managed to finish the workflow and it works.
Here is the new prompt:
{{ $json.text }}{{ $json.headers.subject }}
You are an expert email analyser. Incoming emails need to be labelled. The available labels to associate to the email are:
-
Job_Alerts/Newsletters - The email contains new job suggestions or notifications from a job board.
-
Application_Updates - The email is giving an update on an ongoing application. Could be a rejection or information on progress in the application.
-
Receipts/Confirmation - Confirming a purchase, registration to a service or a 2-factor authentication email.
-
Miscellaneous - The email contents do not align with any of the other labels mentioned.
Your task is to analyse the email subject and contents and then choose an appropriate label to give it. The label must be one of the 4 mentioned above. Do not make up any labels.
Return the label name as a JSON object, nothing else. Do not return an empty object.
Ensure your output is a valid JSON object, not a string containing a JSON object. For example, output: { “labels”: “Job_Alerts/Newsletters” }. Do not surround the JSON object with quotes or additional formatting. Do not include any additional properties or formatting.
And this is what the workflow looks like:
I’ve found that sometimes it can still give an incorrect empty JSON object when the incoming email is too complicated for the llama model to understand, however, i figured that with the model I’m using, it is good enough.
I’ve just noticed the last node is not connected. That was simply for testing purposes. I’ve ran it with that node connected and it works fine.