Skip to content

Commit

Permalink
fix(questions): Tuned sort ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 26, 2023
1 parent f350dc2 commit 6f6b3f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { questionQuery } = require('../lib/embeddings-query');
const util = require('util');

async function main() {
const question = 'How much did my last purchase on Amazon cost?';
const question = process.argv[2] || 'How much did my last purchase on Amazon cost?';

const info = await questionQuery(question, process.env.OPENAI_API_KEY, {
//gptModel: 'gpt-3.5-turbo',
Expand Down
7 changes: 5 additions & 2 deletions lib/embeddings-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ You are analyzing user questions regarding email retrieval from a database. From
**Output Guidelines**:
- For terms implying a near-future context (e.g., "next", "newest", "upcoming"), opt for the 'newer_first' ordering.
- For terms implying a distant past (e.g., "first", "oldest"), use the 'older_first' ordering.
- For terms implying a distant past (e.g., "oldest"), use the 'older_first' ordering.
- For terms implying ordering by time:
- start of the list (e.g., "first"), use the 'older_first' ordering.
- end of the list (e.g., "last", "latest"), opt for the 'newer_first' ordering.
- If the user's query does not provide a clear time frame, or if the system's confidence in deducing a timeframe is below 70%, exclude 'start_time' and 'end_time' from the output.
- If the deduced 'end_time' aligns with current time, omit the 'end_time'.
- For unspecified time zones, timestamps should follow the 'YYYY-MM-DD hh:mm:ss' format.
Expand All @@ -114,7 +117,7 @@ You are analyzing user questions regarding email retrieval from a database. From
- **Query**: "What did James write to me about last Friday?" (assuming that current time is "2023-10-02")
**Response**: \`{"ordering":"best_match", "start_time": "2023-09-29", "end_time": "2023-09-30", "topic": "A message from James about an event in 2023-09-30"}\`
- **Query**: "When did I receive my first Amazon invoice?"
**Response**: \`{"ordering":"older_first", "topic": "Amazon invoice sent last week"}\`
**Response**: \`{"ordering":"older_first", "topic": "Amazon invoice"}\`
**User's Query**:
Process the user question:
Expand Down

0 comments on commit 6f6b3f4

Please sign in to comment.