-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Chat with docs, i.e. Retrieval-based QA etc #17
Comments
Thanks! I currently have no plans to add a chat-based layer of functionality on top of Semantra. My primary motivation for building Semantra was to see how useful of an interface you could make without using any chat completions on top of embeddings. I have experimented with semantic search applications that use chat LLMs, and I've found that no matter what you try there is a risk they will a) fabricate plausible information, b) produce truthful information but not guided by context that uses outside knowledge, or c) provide truly unexpected responses (e.g. via prompt injection). On top of that, they are slow, computationally expensive, and cost significantly more to use than embeddings. I do want to understand more though: what do you feel that you get with a chatbot experience that you don't feel is being met via the current interface of Semantra that shows relevant search results and even highlights relevant phrases within each result? |
Thanks for the reply. I'm also experimenting with langchain's retrieval-QA. It turns out that a very long prompt is needed to avoid hallucination problem, which is very costly. Semantra's semantic search functionality is good enough for "data acquisition" purpose, which is great. But if I want some insights from LLM(which may sound silly, but LLMs sometimes do provide useful insights), I still have to copy-paste relevant paragraphs. Like you said, retrieval-QA can be very costly, so now I suppose it isn't worth adding it. |
@freedmand
Much better way that I found is we do mini CoT (chain of thought) two stages questioning.
|
By the way semantra is designed, I think it should be possible to build on top of its api? Then this project could focus on providing better research results across a wide range of documents, and a separate project could build on top of it to provide the chat interface. @hazxone regarding the case with legal documents, and just potentially numerous and confusing results for the user, I feel like the right step forward is to build/fine tune better embedding models that can deal with this kind of queries better. My tests so far is that whatever that might confuse the user might confuse the LLM even more. Our team got way better results for legal documents after putting each clause in association with each section and chapter, and then embedding each clause and those metadata one by one instead of relying on arbitrary length cutoffs (e.g., Chapter 2. Natural Person - Section 1. Civil Rights - Clause X. Loren ipsum…) |
I think that's exactly right that with a stable API adding any integrations including chatbots would be very easy. With v0.2 (which is under development but may take some time) I want Semantra to be easy to use as an application, backend API server, and even an importable Python library with a simple interface. Interesting to hear the use case of splitting text. I'm also looking into being able to define plug-ins to cover a variety of splitting cases. Embeddings are often sensitive to the length of the input, meaning that sometimes short queries match short texts well so it's not always good to have tons of chunks at different sizes (arbitrary equivalent-sized chunks thus works well as a good default). But having a way to delineate sub-sections within documents that should always be cut-off and never part of overlapping chunks would certainly be useful to improve results quality. |
Thank you for the answer. Understand and I agree that chatbot should be separated from the main program. @yych42 Great ideas on separating the document by logical section. Did you separate it manually? because that would be difficult to automate/find the right pattern to separate for general documents. And also (idea for v0.2) apart from documents, I think search semantically into a bookmarks/webpage also quite useful. |
I like the user interactive design of this project. Is it possible to combine retrieval based QA with the user-friendly interaction of this project?
The text was updated successfully, but these errors were encountered: