https://github.com/awslabs/rhubarb

A Python framework for multi-modal document understanding with Amazon Bedrock

https://github.com/awslabs/rhubarb

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.0%) to scientific vocabulary

Keywords

amazon-bedrock document-processing generative-ai intelligent-document-processing multi-modal
Last synced: 5 months ago · JSON representation

Repository

A Python framework for multi-modal document understanding with Amazon Bedrock

Basic Info
  • Host: GitHub
  • Owner: awslabs
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 32 MB
Statistics
  • Stars: 94
  • Watchers: 6
  • Forks: 12
  • Open Issues: 11
  • Releases: 5
Topics
amazon-bedrock document-processing generative-ai intelligent-document-processing multi-modal
Created almost 2 years ago · Last pushed 8 months ago
Metadata Files
Readme Contributing License Code of conduct

README.md

Rhubarb

[![Amazon Bedrock](https://img.shields.io/badge/Amazon%20Bedrock-8A2BE2?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALUAAAC1BAMAAADrfaOaAAAAD1BMVEUAAAD///////////////+PQt5oAAAABHRSTlMAgL9ARyeO/QAABIpJREFUeNrt22GSmyAUwHGJPUBsOEC6cgBicoCq3P9MrRryT5CAGJxuZ3yftqbz61t44QlMiz322GOPPfb4XlHqYqsojamKbaJUxpj2WGwRA222SV2O8iapN4aoNqB7ITdIXYzi3x+q7KmXA9eN1f1IXWerPkuTep+x+qYhJvUuX/XVz08q125Ut2oGGk+WQr08udmpTqaxCfn85GDGOKZXX9y2pbOq+lTQFuYeek31yaD9w5juKpQx5zXVF7blONSCkk+pvoitppFWSSUvJjpmG/N7KsQuMe2+iNnlYE/Dnma3xRL7vMrWC2w7JsttgPh4tzzKZVOoepz4Nr99G1U5DE12+zAtC8Yc89ulYT1bb1+vemaPg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/K6iM+dLFetw5WXZSXS2zSybpWRf7GCdpiiYbTtKmzkNTie0j6Wv+/4KQP2lwks6Nk3T2EFskDU7S+fFrsccee+yxxx7fP/4AG81mLMegln0AAAAASUVORK5CYII=)](https://aws.amazon.com/bedrock/) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-311/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

Rhubarb

Rhubarb is a light-weight Python framework that makes it easy to build document and video understanding applications using Multi-modal Large Language Models (LLMs) and Embedding models. Rhubarb is created from the ground up to work with Amazon Bedrock and supports multiple foundation models including Anthropic Claude V3 Multi-modal Language Models and Amazon Nova models for document and video processing, along with Amazon Titan Multi-modal Embedding model for embeddings.

What can I do with Rhubarb?

Visit Rhubarb documentation.

Rhubarb can do multiple document processing tasks such as

  • ✅ Document Q&A
  • ✅ Streaming chat with documents (Q&A)
  • ✅ Document Summarization
    • 🚀 Page level summaries
    • 🚀 Full summaries
    • 🚀 Summaries of specific pages
    • 🚀 Streaming Summaries
  • ✅ Structured data extraction
  • ✅ Extraction Schema creation assistance
  • ✅ Named entity recognition (NER)
    • 🚀 With 50 built-in common entities
  • ✅ PII recognition with built-in entities
  • ✅ Figure and image understanding from documents
    • 🚀 Explain charts, graphs, and figures
    • 🚀 Perform table reasoning (as figures)
  • ✅ Large document processing with sliding window approach
  • ✅ Document Classification with vector sampling using multi-modal embedding models
  • ✅ Logs token usage to help keep track of costs

Video Analysis (New!)

  • ✅ Video summarization
  • ✅ Entity extraction from videos
  • ✅ Action and movement analysis
  • ✅ Text extraction from video frames
  • ✅ Streaming video analysis responses

Rhubarb comes with built-in system prompts that makes it easy to use it for a number of different document understanding use-cases. You can customize Rhubarb by passing in your own system prompts. It supports exact JSON schema based output generation which makes it easy to integrate into downstream applications.

  • Supports PDF, TIFF, PNG, JPG, DOCX files (support for Excel, PowerPoint, CSV, Webp, eml files coming soon)
  • Supports MP4, AVI, MOV, and other common video formats for video analysis (S3 storage required)
  • Performs document to image conversion internally to work with the multi-modal models
  • Works on local files or files stored in S3
  • Supports specifying page numbers for multi-page documents
  • Supports chat-history based chat for documents
  • Supports streaming and non-streaming mode
  • Supports Converse API
  • Supports Cross-Region Inference

MCP Server Integration

Rhubarb now includes a built-in FastMCP server that exposes all document and video understanding capabilities through the Model Context Protocol (MCP). This allows seamless integration with MCP-compatible AI assistants like Cline, Claude Desktop, and other MCP clients.

MCP Features

  • 8 Tools: Complete access to all Rhubarb capabilities including document analysis, video processing, entity extraction, and document classification
  • 4 Resources: Built-in discovery for entities, models, schemas, and classification samples
  • Native Python: Direct integration without external dependencies
  • Conversation Memory: Maintains chat history across interactions
  • Flexible Authentication: Support for AWS profiles, access keys, and environment variables

Quick Start with MCP

  1. No installation required - The MCP server auto-installs when first used

  2. Configure in your MCP client (example for Cline): json { "rhubarb": { "command": "uvx", "args": [ "pyrhubarb-mcp@latest", "--aws-profile", "my-profile", "--default-model", "claude-sonnet" ] } }

  3. Alternative configurations: json { "rhubarb": { "command": "uvx", "args": [ "pyrhubarb-mcp@latest", "--aws-access-key-id", "AKIA...", "--aws-secret-access-key", "your-secret", "--aws-region", "us-west-2" ] } }

For detailed MCP server documentation, see README_MCP.md.

Installation

Start by installing Rhubarb using pip.

pip install pyrhubarb

Usage

Create a boto3 session.

python import boto3 session = boto3.Session()

Call Rhubarb

Local file

```python from rhubarb import DocAnalysis

da = DocAnalysis(filepath="./path/to/doc/doc.pdf", boto3session=session) resp = da.run(message="What is the employee's name?") resp ```

With file in Amazon S3

```python from rhubarb import DocAnalysis

da = DocAnalysis(filepath="s3://path/to/doc/doc.pdf", boto3session=session) resp = da.run(message="What is the employee's name?") resp ```

Video Analysis

```python from rhubarb import VideoAnalysis import boto3

session = boto3.Session()

Initialize video analysis with a video in S3

va = VideoAnalysis( filepath="s3://my-bucket/my-video.mp4", boto3session=session )

Ask questions about the video

response = va.run(message="What is happening in this video?") print(response) ```

Large Document Processing

Rhubarb supports processing documents with more than 20 pages using a sliding window approach. This feature is particularly useful when working with Claude models, which have a limitation of processing only 20 pages at a time.

To enable this feature, set sliding_window_overlap to a value between 1 and 10 when creating a DocAnalysis object:

python doc_analysis = DocAnalysis( file_path="path/to/large-document.pdf", boto3_session=session, sliding_window_overlap=2 # Number of pages to overlap between windows (1-10) )

When the sliding window approach is enabled, Rhubarb will: 1. Break the document into chunks of 20 pages 2. Process each chunk separately 3. Combine the results from all chunks

Note: The sliding window technique is not yet supported for document classification. When using classification with large documents, only the first 20 pages will be considered.

For more details, see the Large Document Processing Cookbook.

For more usage examples see cookbooks.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Create event: 19
  • Release event: 4
  • Issues event: 14
  • Watch event: 45
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 34
  • Pull request review comment event: 3
  • Pull request review event: 6
  • Pull request event: 24
  • Fork event: 6
Last Year
  • Create event: 19
  • Release event: 4
  • Issues event: 14
  • Watch event: 45
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 34
  • Pull request review comment event: 3
  • Pull request review event: 6
  • Pull request event: 24
  • Fork event: 6

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 13
  • Total pull requests: 48
  • Average time to close issues: 10 days
  • Average time to close pull requests: about 1 month
  • Total issue authors: 10
  • Total pull request authors: 6
  • Average comments per issue: 0.31
  • Average comments per pull request: 0.42
  • Merged pull requests: 29
  • Bot issues: 1
  • Bot pull requests: 20
Past Year
  • Issues: 13
  • Pull requests: 31
  • Average time to close issues: 10 days
  • Average time to close pull requests: about 1 month
  • Issue authors: 10
  • Pull request authors: 4
  • Average comments per issue: 0.31
  • Average comments per pull request: 0.32
  • Merged pull requests: 23
  • Bot issues: 1
  • Bot pull requests: 9
Top Authors
Issue Authors
  • pesravan45 (2)
  • flamingquaks (2)
  • reachrajb (2)
  • rzaupa (1)
  • ssingh-01 (1)
  • kedjeha (1)
  • eldimi (1)
  • dependabot[bot] (1)
  • michael-sponsorcx (1)
  • gowthamshankar99 (1)
Pull Request Authors
  • gowthamshankar99 (22)
  • dependabot[bot] (21)
  • flamingquaks (3)
  • austinmw (2)
  • mmarinm (2)
  • anjanvb (2)
Top Labels
Issue Labels
bug (1) feature request (1) enhancement (1) dependencies (1) javascript (1)
Pull Request Labels
dependencies (21) python (4) javascript (2)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 43,497 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 8
  • Total maintainers: 1
pypi.org: pyrhubarb-mcp

MCP server for Rhubarb document and video understanding capabilities

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 8.6%
Average: 28.6%
Dependent repos count: 48.5%
Maintainers (1)
Last synced: 6 months ago
pypi.org: pyrhubarb

A Python framework for multi-modal document understanding with generative AI

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 43,497 Last month
Rankings
Dependent packages count: 9.5%
Average: 36.2%
Dependent repos count: 62.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/documentation.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • peaceiris/actions-gh-pages v4 composite
.github/workflows/publish-to-pypi.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
poetry.lock pypi
  • alabaster 0.7.16
  • annotated-types 0.6.0
  • attrs 23.2.0
  • babel 2.14.0
  • beautifulsoup4 4.12.3
  • bleach 6.1.0
  • boto3 1.34.71
  • botocore 1.34.71
  • certifi 2024.2.2
  • cffi 1.16.0
  • cfgv 3.4.0
  • charset-normalizer 3.3.2
  • colorama 0.4.6
  • cryptography 42.0.5
  • defusedxml 0.7.1
  • distlib 0.3.8
  • docutils 0.21.1
  • fastjsonschema 2.19.1
  • filelock 3.13.3
  • furo 2024.1.29
  • identify 2.5.35
  • idna 3.7
  • imagesize 1.4.1
  • importlib-metadata 7.1.0
  • jinja2 3.1.3
  • jmespath 1.0.1
  • jsonschema 4.21.1
  • jsonschema-specifications 2023.12.1
  • jupyter-client 8.6.1
  • jupyter-core 5.7.2
  • jupyterlab-pygments 0.3.0
  • markupsafe 2.1.5
  • mistune 3.0.2
  • nbclient 0.10.0
  • nbconvert 7.16.3
  • nbformat 5.10.4
  • nbsphinx 0.9.3
  • nodeenv 1.8.0
  • numpy 1.26.4
  • packaging 24.0
  • pandocfilters 1.5.1
  • pdfminer-six 20231228
  • pdfplumber 0.11.0
  • pillow 10.3.0
  • platformdirs 4.2.0
  • pre-commit 3.7.0
  • pyarrow 15.0.2
  • pycparser 2.21
  • pydantic 2.6.4
  • pydantic-core 2.16.3
  • pygments 2.17.2
  • pypdfium2 4.28.0
  • python-dateutil 2.9.0.post0
  • pywin32 306
  • pyyaml 6.0.1
  • pyzmq 26.0.0
  • referencing 0.34.0
  • requests 2.31.0
  • rpds-py 0.18.0
  • ruff 0.3.4
  • s3transfer 0.10.1
  • setuptools 69.2.0
  • six 1.16.0
  • snowballstemmer 2.2.0
  • soupsieve 2.5
  • sphinx 7.3.4
  • sphinx-basic-ng 1.0.0b2
  • sphinx-copybutton 0.5.2
  • sphinxcontrib-applehelp 1.0.8
  • sphinxcontrib-devhelp 1.0.6
  • sphinxcontrib-htmlhelp 2.0.5
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 1.0.7
  • sphinxcontrib-serializinghtml 1.1.10
  • tinycss2 1.2.1
  • tomli 2.0.1
  • tornado 6.4
  • traitlets 5.14.2
  • typing-extensions 4.10.0
  • urllib3 1.26.18
  • urllib3 2.2.1
  • virtualenv 20.25.1
  • webencodings 0.5.1
  • zipp 3.18.1
pyproject.toml pypi
  • furo ^2024.1.29 develop
  • nbsphinx ^0.9.3 develop
  • pre-commit ^3.7.0 develop
  • ruff ^0.3.4 develop
  • sphinx ^7.3.4 develop
  • sphinx-copybutton ^0.5.2 develop
  • boto3 ^1.34.71
  • botocore ^1.34.71
  • jsonschema ^4.21.1
  • numpy ^1.26.4
  • pdfplumber ^0.11.0
  • pillow ^10.3.0
  • pyarrow ^15.0.2
  • pydantic ^2.6.4
  • python >=3.9
requirements.txt pypi
  • annotated-types ==0.6.0
  • attrs ==23.2.0
  • boto3 ==1.34.71
  • botocore ==1.34.71
  • cffi ==1.16.0
  • charset-normalizer ==3.3.2
  • cryptography ==42.0.5
  • jmespath ==1.0.1
  • jsonschema ==4.21.1
  • jsonschema-specifications ==2023.12.1
  • numpy ==1.26.4
  • pdfminer-six ==20231228
  • pdfplumber ==0.11.0
  • pillow ==10.3.0
  • pyarrow ==15.0.2
  • pycparser ==2.21
  • pydantic ==2.6.4
  • pydantic-core ==2.16.3
  • pypdfium2 ==4.28.0
  • python-dateutil ==2.9.0.post0
  • referencing ==0.34.0
  • rpds-py ==0.18.0
  • s3transfer ==0.10.1
  • six ==1.16.0
  • typing-extensions ==4.10.0
  • urllib3 ==2.2.1
sample_deployments/cdk_lambda_docker/source/lambda/Dockerfile docker
  • public.ecr.aws/lambda/python 3.12-x86_64 build
sample_deployments/cdk_lambda_native/package-lock.json npm
  • 311 dependencies
sample_deployments/cdk_lambda_native/package.json npm
  • aws-cdk 2.153.0 development
  • jest ^29.7.0 development
  • aws-cdk-lib 2.153.0
  • constructs ^10.0.0
sample_deployments/cdk_lambda_docker/requirements-dev.txt pypi
  • pytest ==6.2.5 development
sample_deployments/cdk_lambda_docker/requirements.txt pypi
  • aws-cdk-lib ==2.141.0
  • constructs >=10.0.0,<11.0.0
sample_deployments/cdk_lambda_docker/source/lambda/requirements.txt pypi
  • boto3 *
  • pyrhubarb *
sample_deployments/cdk_lambda_native/src/requirements.txt pypi
  • pyrhubarb *