Steve, this is outstandingly helpful for a non-technical person. I really appreciate it. (And the book is outstanding too - I’m on page 37 so far.)
I used Replit and followed your step-by-step instructions for a file upload and I succeeded in uploading a simple json lines file, and changing the purpose to search. My file-upload.js includes the following (slightly modified for search and for the name of my json lines file):
// 2. Get the data file ready for the http post
const data = new FormData();
data.append(‘purpose’, ‘search’);
data.append(‘file’, fs.createReadStream(‘les-search-test.jsonl’));
// 3. Set http request parameters for axios
const params = {
method: ‘post’,
url: ‘https://api.openai.com/v1/files’,
headers: {
‘Authorization’: 'Bearer ’ + process.env.OPENAI_API_KEY,
…data.getHeaders()
},
query: ‘where do fish go’,
max_rerank: ‘5’,
search_model: ‘davinci’,
file: ‘les-search-test.jsonl’,
data : data
};
As you can see, I added to your sample code a query, the search_model, the name of my json lines file, and max_rerank. I don’t know for sure if my changes to the code are correct, but I am getting the following run results:
node file-upload.js
{“id”:“file-1nZxVbD6uvjjsAb5RR3tuWVn”,“object”:“file”,“bytes”:275,“created_at”:1626806729,“filename”:“les-search-test.jsonl”,“purpose”:“search”,“status”:“uploaded”,“status_details”:null}
So far so good?
Your next instructions say “the id value is what you’ll need from the response to use the file with the search, classifications, or answers endpoint.”
I’m now stuck. I also followed your instructions for simple search and that worked really well. (And GPT-3’s results were brilliant, as they’ve been in the playground so far). On Replit, it’s the combination of using the search endpoint and uploading a json lines file that I can’t seem to figure out. Your help would be greatly appreciated. Thanks very much Steve.