Thanks for the answer @lmccallum
Currently I’m not using embeddings or whatever it’s called (do I need those?)
What I am doing currently with my QA bot is basically (simplified):
- User asks bot: “How is the xyz fee processed?”
- Bot takes the whole conversation (every time) and classifies it with davinci (to get good context), like:
Classify following into these 3 categories: GREETINGS, XYZ, OTHERS
Example:
1. Hi <GREETINGS>
2. Wanna ask about xyz <XYZ>
3. Hows the fee processed? <XYZ>
... about 15 examples of context ...
Not classified:
1. ... Here I paste the last 15 lines of the chat for it to classify. I just need the last message, but the more messages, the better it can detect context ...
Classification:
1. ... Here it begins autocompleting and numbering up, works well enough
-
If it classified the LAST chat message as <XYZ>, for example, it creates a new prompt (loading the pasted document from a XYZ.txt file) like:
DOCUMENT:
At xyz, we process the fee like xyz. Also we do x, y and z. Our service... etc etc giant document, takes ***2.5K*** tokens.
Based on the document above, answer following question:
A conversation between a client and Jane. Etc etc setting the tone. ...This is a header snippet file, used throughout the project...
... Here I paste the last 5 chat messages for context ...
Jane: ...Here the bot autocompletes the answer, works extremely well...
- Get the answer from the last Jane above and return it to the user. Since it’s given the tone in step 3, together with the document to answer, it maintains the conversation’s tone pretty well and fits in perfectly.
This works pretty well and allows me to query multiple documents, depending on what’s being talked, but consumes an abismal amount of tokens. Any help is greatly appreciated.
And yes, I’ve watched multiple of davids videos, they’re awesome and inspired me of this architecture.
How the files really look
Of course my files look like:
DOCUMENT:
{{ doc }}
###
Based on the document above, answer following question:
{{ header }}
{{ chat }}
Jane:
But to simplify things, I’ve commented everything in the post. Also, the prompts are not exactly in the same words as the ones I use. I won’t open all of them now just for the sake of demonstration ahaha What remains the same, however, is the architecture and the structure in which I did it.