@postalsys/email-ai-tools 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.1](https://github.com/postalsys/email-ai-tools/compare/v1.6.0...v1.6.1) (2023-10-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **chat:** Include the name and email of the person asking the question in the prompt for context ([79bf33c](https://github.com/postalsys/email-ai-tools/commit/79bf33ca1ccd47e3680e912aebe8bcd243578507))
9
+
3
10
  ## [1.6.0](https://github.com/postalsys/email-ai-tools/compare/v1.5.1...v1.6.0) (2023-10-02)
4
11
 
5
12
 
@@ -21,7 +21,9 @@ You are an automated system designed to extract and provide information based on
21
21
  const SCHEMA_PROMPT = `
22
22
  **Input Information:**
23
23
 
24
- - **Question Format:** The query is presented using the JSON schema: \`{"question":"What was the date of our last meeting?"}\`
24
+ - **Question Format:** The query is presented using the JSON schema: \`{"name": "John Doe", "email": "john@example.com", "question":"What was the date of our last meeting?"}\`
25
+
26
+ - **Question Structure** The question format includes the asked question, and the name and the email address of the user who asked the question, if available.
25
27
 
26
28
  - **Email Context:** We are provided with a series of emails to analyze.
27
29
 
@@ -55,6 +57,10 @@ const SCHEMA_PROMPT = `
55
57
  - On a new line, begin with \`Message-ID:\` and cite the unique Message-ID(s) of the emails you sourced your answer from.
56
58
  5. Ensure that the Message-ID is never embedded within the main body of your response.
57
59
  6. Avoid including any additional commentary or annotations.
60
+
61
+ **Context**:
62
+
63
+ - The current time is '${new Date().toUTCString()}'.
58
64
  `.trim();
59
65
 
60
66
  const QUESTION_PROMPT = `
@@ -128,10 +134,10 @@ async function embeddingsQuery(apiToken, opts) {
128
134
  while (true) {
129
135
  prompt = `${SCHEMA_PROMPT}
130
136
 
131
- Input:
132
- ${JSON.stringify({ question })}
137
+ **Input**:
138
+ ${JSON.stringify({ name: opts?.userData?.name, email: opts?.userData?.email, question })}
133
139
 
134
- Context emails:
140
+ **Context emails**:
135
141
 
136
142
  ${promptText}
137
143
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postalsys/email-ai-tools",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Email AI tools",
5
5
  "main": "index.js",
6
6
  "scripts": {