Skip to content

Commit

Permalink
fix(chat): Include the name and email of the person asking the questi…
Browse files Browse the repository at this point in the history
…on in the prompt for context
  • Loading branch information
andris9 committed Oct 2, 2023
1 parent e3c27cf commit 79bf33c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/embeddings-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ You are an automated system designed to extract and provide information based on
const SCHEMA_PROMPT = `
**Input Information:**
- **Question Format:** The query is presented using the JSON schema: \`{"question":"What was the date of our last meeting?"}\`
- **Question Format:** The query is presented using the JSON schema: \`{"name": "John Doe", "email": "[email protected]", "question":"What was the date of our last meeting?"}\`
- **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.
- **Email Context:** We are provided with a series of emails to analyze.
Expand Down Expand Up @@ -55,6 +57,10 @@ const SCHEMA_PROMPT = `
- On a new line, begin with \`Message-ID:\` and cite the unique Message-ID(s) of the emails you sourced your answer from.
5. Ensure that the Message-ID is never embedded within the main body of your response.
6. Avoid including any additional commentary or annotations.
**Context**:
- The current time is '${new Date().toUTCString()}'.
`.trim();

const QUESTION_PROMPT = `
Expand Down Expand Up @@ -128,10 +134,10 @@ async function embeddingsQuery(apiToken, opts) {
while (true) {
prompt = `${SCHEMA_PROMPT}
Input:
${JSON.stringify({ question })}
**Input**:
${JSON.stringify({ name: opts?.userData?.name, email: opts?.userData?.email, question })}
Context emails:
**Context emails**:
${promptText}
`;
Expand Down

0 comments on commit 79bf33c

Please sign in to comment.