Skip to main content

Scientific Document Insight Q/A

Project description


title: Scientific Document Insights Q/A emoji: 📝 colorFrom: yellow colorTo: pink sdk: streamlit sdk_version: 1.27.2 app_file: streamlit_app.py pinned: false license: apache-2.0

DocumentIQA: Scientific Document Insights Q/A

Work in progress :construction_worker:

Introduction

Question/Answering on scientific documents using LLMs: ChatGPT-3.5-turbo, Mistral-7b-instruct and Zephyr-7b-beta. The streamlit application demonstrate the implementaiton of a RAG (Retrieval Augmented Generation) on scientific documents, that we are developing at NIMS (National Institute for Materials Science), in Tsukuba, Japan. Differently to most of the projects, we focus on scientific articles. We target only the full-text using Grobid that provide and cleaner results than the raw PDF2Text converter (which is comparable with most of 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 conversation is kept in memory up by a buffered sliding window memory (top 4 more recent messages) and the messages are injected in the context as "previous messages".

Demos:

Getting started

  • Select the model+embedding combination you want ot use
  • Enter your API Key (Open AI or Huggingface).
  • Upload a scientific article as PDF document. You will see a spinner or loading indicator while the processing is in progress.
  • Once the spinner stops, you can proceed to ask your questions

screenshot2.png

Documentation

Context size

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.

Chunks size

When uploaded, each document is split into blocks of a determined size (250 tokens by default). This setting allow users to modify the size of such blocks. Smaller blocks will result in smaller context, yielding more precise sections of the document. Larger blocks will result in larger context less constrained around the question.

Query mode

Indicates whether sending a question to the LLM (Language Model) or to 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.

NER (Named Entities Recognition)

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, masurements). This feature leverages both grobid-quantities and grobid-superconductors external services.

Development notes

To release a new version:

  • bump-my-version bump patch
  • git push --tags

To use docker:

  • docker run lfoppiano/document-insights-qa:latest

To install the library with Pypi:

  • pip install document-qa-engine

Acknolwedgement

This project is developed at the National Institute for Materials Science (NIMS) in Japan in collaboration with the Lambard-ML-Team.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

document-qa-engine-0.3.1.tar.gz (452.9 kB view details)

Uploaded Source

Built Distribution

document_qa_engine-0.3.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file document-qa-engine-0.3.1.tar.gz.

File metadata

  • Download URL: document-qa-engine-0.3.1.tar.gz
  • Upload date:
  • Size: 452.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for document-qa-engine-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a227246f104a5b789c6a78144f75d620d40bdcccd2cf98376612a85ae80ba894
MD5 d2e541186afc6aa02bf07826d9145076
BLAKE2b-256 9d5d165d3787e40e1f80d2b9de6aa244a008f4fef0206fb67b841b8da13d4bce

See more details on using hashes here.

File details

Details for the file document_qa_engine-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for document_qa_engine-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7ad223259159112743c0dbc9bd9d0544fdc12fac8f6659bd02e6e39b8efb881
MD5 160c11f0a65dfabcaa06c06e8a2b3689
BLAKE2b-256 3eb24056b016403b36c6d331f55507c3f02a67782f63573a8da50ef11faa4b52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page