> In the analyzing step, ChatPDF creates a semantic index over all paragraphs of the PDF. When answering a question, ChatPDF finds the most relevant parapgrahs from the PDF and uses the ChatGPT API from OpenAI to generate an answer.
Are you using OpenAI's embeddings to implement that?
For a simple example, a car manual where you want to change the brakes, it probably won't tell you in the brake section how to remove the wheels. You have to look at the wheel section. And in the wheel section it won't tell you about the nuts, you have to look in the spec sheets. And the spec sheet won't have the torque, you have to look in the chapter reference.
Often times they are not nice enough to point you to the relevant sections, you just have to stumble around the manual for a long time.
1. User enters question 2. Semantic search for relevant sections of input material 3. Prompt LLM if it needs any further context to answer the question 4. GOTO 2 5. Finish
- Mathis from ChatPDF
That is incredibly interesting. We really need an Internet-scale semantic search engine API to try out this and make interesting LLM-based tools. Hooking up LLMs to classic keyword search engines like Bing and Google often gives underwhelming results.
Docalysis also shows you the PDF side-by-side, has page numbers, and overall responses are of better quality according to users that have emailed comparisons to ChatPDF.
https://news.ycombinator.com/reply?id=35628748&goto=item%3Fi...
I know of a few approaches for that:
- Ignore the problem and let it hallucinate answers to anything that's not in the first 5-10 pages
- Attempt to recursively summarize the PDF at the start - so summarize e.g. pages 1-3, then 4-6 etc, then if the resulting summaries are still too long for the context window run a summary of those summaries. Use the summary in the context to help answer the user's questions.
- Implement a mechanism for finding the most likely subset of the PDF content to include in the prompt based on the user's question. You could use the LLM to extract likely search terms, then run a dumb search for those terms and include the surrounding text in the prompt - or you could calculate embeddings on the different sections of the document and do a semantic search against it to find the most appropriate sections, as I did in https://simonwillison.net/2023/Jan/13/semantic-search-answer...
Which approach did you use? Am I missing any options here?