Repository

structured-qa

Blueprint by Mozilla.ai for answering questions about structured documents

Google Colab
HuggingFace Spaces

Specs

  • Google ColabHuggingFace Spaces

README

Project logo

![Python](https://img.shields.io/badge/Python-3.10%2B-blue) [![llama.cpp](https://img.shields.io/badge/llama.cpp-E76F00?logo=cplusplus&logoColor=white&labelColor=1E1E1E)](https://github.com/ggml-org/llama.cpp) [![pymupdf4llm](https://img.shields.io/badge/pymupdf4llm-blue)](https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) [![](https://dcbadge.limes.pink/api/server/YuMNeuKStr?style=flat)](https://discord.gg/YuMNeuKStr) [![Docs](https://github.com/mozilla-ai/structured-qa/actions/workflows/docs.yaml/badge.svg)](https://github.com/mozilla-ai/structured-qa/actions/workflows/docs.yaml/) [![Tests](https://github.com/mozilla-ai/structured-qa/actions/workflows/tests.yaml/badge.svg)](https://github.com/mozilla-ai/structured-qa/actions/workflows/tests.yaml/) [![Ruff](https://github.com/mozilla-ai/structured-qa/actions/workflows/lint.yaml/badge.svg?label=Ruff)](https://github.com/mozilla-ai/structured-qa/actions/workflows/lint.yaml/) [Blueprints Hub](https://developer-hub.mozilla.ai/) | [Documentation](https://mozilla-ai.github.io/structured-qa/) | [Getting Started](https://mozilla-ai.github.io/structured-qa/getting-started/) | [Contributing](CONTRIBUTING.md)

Structured-QA: a Blueprint by Mozilla.ai for answering questions about structured documents.

This Blueprint demonstrates how to use open-source models and a simple LLM workflow to answer questions based on structured documents.

It is designed to showcase a simpler alternative to more complex and/or resource-demanding alternatives, such as RAG systems that rely on vector databases and/or long-context models with large token windows.

Structured QA Diagram

Quick-start

Get started with structured-qa using one of the options below:

Google Colab HuggingFace Spaces GitHub Codespaces
Try on Colab Try on Spaces Try on Codespaces

You can also install and use the blueprint locally:

Command Line Interface

pip install structured-qa
structured-qa \
--question "What optimizer was used to train the model?" \
--input_file "example_data/1706.03762v7.pdf" \
--output_dir "example_outputs/1706.03762v7.pdf"

Graphical Interface App

git clone https://github.com/mozilla-ai/structured-qa.git
cd structured-qa
pip install -e .
python -m streamlit run demo/app.py

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Contributing

Contributions are welcome! To get started, you can check out the CONTRIBUTING.md file.