Hi Guys, I am a newbie here and trying to get my head around all these things about Assistants and file_search tool. So please pardon me if I ask something very basic!
So, I am trying to build an Assistant that would act as a tutor on specific subject, say, physics. It will use a specific physics book to answer a user’s question. Now, what I have done is create a vector store and uploaded a pdf copy of the book into it, then instructed the Assistant to use it whenever answering a question asked to it.
Problem is, even for a simple question for which the answer is barely 50 words, it uses up thousands of tokens, which is clearly not feasible. To make it cost efficient I am thinking to implement the following,
- Segment the book by it’s chapters and have seperate vector stores for each chapter.
- Each vector store will have multiple .json files for each section of the chapter.
- Each .json file will have the following structure (content in Bengali), as an example,
{
"id": "4.0",
"content": "কঠিন, তরল ও বায়বীয় পদার্থের এই তিন অবস্থায় থাদের ধর্ম ও বৈশিষ্ট ভিন্ন হয়ে থাকে, ফলে তাদের ব্যবহারও তিন অবস্থায় ভিন্ন হয়। এই অধ্যায়ে পদার্থের বিভিন্ন অবস্থার প্রেক্ষিতে তাদের ধর্ম ও বৈশিষ্ট এবং দৈনন্দিন জীবনের সঙ্গে সংশ্লিষ্ট বিভিন্ন বিষয় আলোচনা করা হয়েছে। বিষয়গুলো হলো:\n১: পদার্থের তিনটি অবস্থা।\n২: কণার গতিতত্ব।\n৩: ব্যাপন, নিঃসরণ।\n৪: মোমবাতির জ্বলন এবং মোমের তিনটি অবস্থা।\n৫: গলন ও স্ফুটন, পাতন ও উর্ধ্বপাতন।",
"metadata": {
"title": "সূচনা",
"tags": ["মূল বিষয়", "মূল বিষয়সমূহ", "মূল বিষয় সমূহ", "বিষয়", "topic", "main topic", "main বিষয়"]
}
}
What I want the assistant to do is following,
Whenever the user asks a question, if the question consists of certain keyword, it will query only those files in the vector stores where the same keyword has been used as a tag. Then answer the question using only the contents of those files.
How can I achieve this? Is simple prompt engineering going to be enough? If so, can I specify the rules to use certain files for certain keywords by mentioning the file_id? Or do I need to do function calling?
Any suggestions/guidelines will be much appreciated. If you have done something similar and don’t mind sharing that would be amazing! Thanks for reading!