Unable to maintain conversation for Q&A on large text


I am unable to maintain a session for a particular conversation.
I am trying to make a Q&A bot which reads the text on the current webpage and answer question to the user based on this text.
I am using completion api and it works well on the first request where I give the long text and the question. For the second question, I don’t want to give entire paragraph again but just the question.
How can I maintain the conversation session for this purpose or any other better way?


{“model”:“text-davinci-003”,“prompt”:“Some long paragraph on current webpage.\n\nTLDR; Bot\n\nMe\n\nsummarize in 20 words\n\n6:35:30 pm\n\nSend\n$Request failed with status code 400 \n\n summarize",“echo”:false,“max_tokens”:1000,“n”:1,“temperature”:1,“user”:"user@gmail.com”}

1 Like

Hey @sajjadmanal ! This is a good question, one possible way of doing this is to use some of the summarization features to keep a high level context of the conversation present. Another way of doing so would be to use embeddings to keep track of the conversations, and that way if questions about the previous text come up, you will have that info embedded. I am working on some tutorials that will help with this but hopefully this gives some ideas in the meantime.


Thanks @logankilpatrick Will wait for your tutorials.

thanks, @logankilpatrick Will wait for your tutorials. Can u post the links of the tutorials here?

@logankilpatrick, have the same question here: Context generation for chat based Q&A bot

Any suggestions yet?

hi, solution to your problem can be found in chapter 5.1 of the article https://arxiv.org/pdf/2303.12712.pdf