How to automatically read flat files

I am trying to create prompts from a flat file of data instead of spending the time to reformat the file into input and response format. I want to have OpenAI read text like below and transform it into information it can use to respond to questions:

Through our more than 1,000 stores in 6 states as of the end of fiscal-year 2021, we serve a wide variety of communities across the country, many of which other retailers have chosen not to serve. We are proud to be located within five miles of approximately 35% of the U.S. population, providing millions of individuals each day with the quality, affordable products they need and want.

I can then I can have the following conversation with OpenAI:
user: how many stores do you have
OpenAI: 1000 stores in 6 states as of the end of 2021.
user: what percent of the stores are near the US population?
OpenAI: we are close to 35% of the US population.

Any suggestions on how to proceed? I am very, very, new to OpenAI. I still get the community guidelines :wink:



1 Like

Hi Stephanie, You can convert file to jsonl format and upload for searching. Did you look at this part?

How large is the text?

Do you already know what part (page, chapter, paragraph, section, whatever) of the text is relevant to the response?

Hi @ssylve1445

It appears that you want to generate prompt-completion pairs using GPT-3. It is certainly possible.

Here’s an example of how one can prompt GPT-3 to do this. The prompt should consist of:

  1. Data: In this case :arrow_down:
  1. Sample of what you want: In this case :arrow_down:
  1. Completion prompt: This will be something that will prompt GPT3 to generate QnA pairs. In this case prompt can be: Following is the set of possible questions and answers from given data:

Or the completion prompt can also be left empty after the samples and the call made right at \n user:

This provides additional clarity. I will give it a try and let you know.



1 Like