Upload file for the purpose of "answering" questions

Hello,

My objective is to upload a file for the purpose of answering questions. I don’t need a prompt and completion. All I need is to provide a text and ask the AI questions about that text.

I understand that the search and answering endpoints have been deprecated so there must be another way to do this.

At the moment, I’m able to upload files and create fine-tunings for them.

$open_ai->uploadFile([
     "purpose" => "fine-tune",
     "file" => $c_file,
]);
$open_ai->createFineTune([
     "training_file" => "file-xxxxxxx",
]);

But as you can see there’s no other purpose except fine-tune, I looked all over the documentation and there’s no answer purpose.

On top of that, the dataset that I have to provide must have prompt and completion so that can’t be the way to achieve what I want.

So how can I achieve this? All I want to do is upload a jsonl file with a text and ask the AI about it.

1 Like

Hello Halnex,

Have you seen the answers transition guide Answers Transition Guide | OpenAI Help Center? It doesn’t seem to be linked from the answers API documentation where it says it is deprecated, but was posted in this forum. It outlines how the API was implemented and how it could be replicated.

Basically if you want to generate answers about a specific text you need to include that text in your prompt. Most of the work done by the answers API is to identify the most relevant documents using a traditional text search (elasticsearch) and generate prompts for each in turn. The suggested advice is to use the new embeddings based search service in place of elasticsearch and generate the prompt yourself.

1 Like

Can you please give me a link on how to do this? Please give me a link which is complete.

Check this app, it’s written in Laravel [PHP] and allows you to upload PDF files and have a Q&A session using OpenAI.

https://github.com/geosem42/SwiftAI