Can you use Gemini to answer questions based on a single text data source?

Sorry if this entire post sounds very layman but I am very new to using AI. I have fiddled with creating a python chatbot using the startChat but I am not really sure how to move forward with my goal.

Is there a way to create a chatbot that uses a text document as the only reference material when you ask it questions? Lets say for example, a company has a large employee handbook and you wanted to make a chatbot that could answer any questioned relating to policies listed in the book. Is there a way to make a Gemini chatbot that will look at the employee handbook and answer questions based only on the information provided in that document?

I have been learning a bit about key-value pairs but I don’t really think that is my goal. I would rather like the AI look at the document and review it for the most appropriate answer based on the information provided in the employee handbook.

Again, sorry that I sound like a 5 year old asking about this. I am very new to using AI and I was hoping this community could help me out. Thank you ahead of time for any information you can provide.

2 Likes

Welcome aboard. From your brief requirements statement, my first impression is that you should look at implementing an AQA model based app.

Welcome to the forum @LivingDataModel

Would Get started with semantic retrieval be a good starting point to setup something like this? I am not sure if you have ever worked with a RAG pipeline before or not but can I expect typical human like responses?

As a side note, if I did something like asked it to create an article on a specific subject within the context. Can it handle that or would you be more likely to get a better response from Gemini Pro reading the context and providing a long form answer? Or maybe an app that used RAG and then submitted its answer to the Gemini model and asks it to write an article based on the answer it got from the source context using RAR?

Sorry if I am wording this wrong. I am still very new to the lingo and really all of it.

I stand by my original advice. AQA is semantic retrieval. It’s the best approach for a fixed, yet updateable, document store from which the model responses are grounded.

You can also leverage the very large context size and put your documents in-context. That will work great and will be very, very quick to develop. I started out, I stand by my original advice, because the second option means you get to retokenize your documents with every request, so if they are not trivially short, you will use up a lot of tokens, which can translate into $.

Prototyping it as an in-context solution is obviously also fine, and then heading to semantic retrieval. Hope that helps.

When you say second option what specifically are you talking about? Like using Gemini 1.5 instead of the AQA model? Also, you mentioned in-context, is that a term I should understand? Can you expand on this a bit? Would Get started with semantic retrieval be a good example to follow to get started?

Yes, second option is, you put your document in the system instruction or in the prompt (in code) “above” the actual query. That is then considered in-context. Because the protocol is stateless, you have to resend your document with every prompt. This technique applies to a model such as gemini-1.0 or 1.5 or 1.5 flash.

Yes you can , use it