title: Scientific Document Insights Q/A emoji: 📝 colorFrom: yellow colorTo: pink sdk: streamlit sdk_version: 1.37.1 app_file: streamlit_app.py pinned: false license: apache-2.0 app_port: 8501
Work in progress :construction_worker:
https://lfoppiano-document-qa.hf.space/
NOTE: The LLM API is kindly provided by Modal.com which offers 30$/month for computing. When these are done, the app will stop answering. 😅
Question/Answering on scientific documents using LLMs. The tool can be customized to use different types of LLM APIs. The streamlit application demonstrates the implementation of a RAG (Retrieval Augmented Generation) on scientific documents. Different from most of the projects, we focus on scientific articles and extract text from a structured document. We target only the full text using Grobid which provides cleaner results than the raw PDF2Text converter (which is comparable with most of the other solutions).
Additionally, this frontend provides the visualisation of named entities on LLM responses to extract physical quantities, measurements (with grobid-quantities) and materials mentions (with grobid-superconductors).
(The image on the right was generated with https://huggingface.co/spaces/stabilityai/stable-diffusion)

For full technical documentation of the document-qa-engine library docs/README.md.
To deploy the LLM and embedding endpoints on Modal.com, see document_qa/deployment/README.md.
In the latest version, there is the possibility to select both embedding functions and LLMs. There are some limitations, OpenAI embeddings cannot be used with open source models, and vice-versa.
Allow to change the number of blocks from the original document that are considered for responding. The default size of each block is 250 tokens (which can be changed before uploading the first document). With default settings, each question uses around 1000 tokens.
NOTE: if the chat answers something like "the information is not provided in the given context", changing the context size will likely help.
When uploaded, each document is split into blocks of a determined size (250 tokens by default). This setting allows users to modify the size of such blocks. Smaller blocks will result in a smaller context, yielding more precise sections of the document. Larger blocks will result in a larger context less constrained around the question.
Indicates whether sending a question to the LLM (Language Model) or the vector storage. - LLM (default) enables question/answering related to the document content. - Embeddings: the response will consist of the raw text from the document related to the question (based on the embeddings). This mode helps to test why sometimes the answers are not satisfying or incomplete. - Question coefficient (experimental): provide a coefficient that indicates how the question has been far or closed to the retrieved context
This feature is specifically crafted for people working with scientific documents in materials science. It enables to run NER on the response from the LLM, to identify materials mentions and properties (quantities, measurements). This feature leverages both grobid-quantities and grobid-superconductors external services.
Error: streamlit: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0.
Here is the solution on Linux.
For more information, see the details on the Chroma website.
Please read carefully:
To release a new version:
bump-my-version bump patch git push --tagsTo use docker:
docker run lfoppiano/document-insights-qa:{latest_version}
docker run lfoppiano/document-insights-qa:latest-develop for the latest development version
To install the library with Pypi:
pip install document-qa-engine The project was initiated at the National Institute for Materials Science (NIMS) in Japan. Currently, the development is possible thanks to ScienciLAB. This project was contributed by Guillaume Lambard and the Lambard-ML-Team, Pedro Ortiz Suarez, and Tomoya Mato. Thanks also to Patrice Lopez, the author of Grobid.
$ claude mcp add document-qa \
-- python -m otcore.mcp_server <graph>