Need to ask questions to given dataset

I have a given text, lets suppose a PHD paper. I want to feed it to the API & get the answers I need instead of reading whole paper. I see AI can answer questions but I want it to answer from given data. How can I do it? Maybe some codex or any reference would help.

Now suppose first part can be solved by somehow sending the whole dateset to AI & asking a question. I think something like this can happen as AI doesn’t have a storage.
Now if I keep sending 10 page full of data to answer question every time it would cost a lot of tokens. How can I minimize it?