Skip to main content

climatextract

📖 Documentation: gist-sustainability.github.io/climatextract

climatextract is a retrieval-augmented generation (RAG) pipeline that surfaces CO₂ emissions data from corporate sustainability reports. It embeds PDF pages, ranks relevant context, and prompts a large language model to extract Scope 1-3 emissions into structured tables for downstream analysis.

Background

This project began as the team's submission for the 2024 ClimateNLP workshop at ACL. Built by the LMU SODA Lab in collaboration with the Data Service Centre of Deutsche Bundesbank, climatextract combines research around ESG reporting and Intelligent Document Processing to automate what was previously a tedious manual annotation process.

This repository is organized as follows:

  • climatextract: package source code
  • data: source data to be analyzed
  • docs: package documentation (built with mkdocs)
  • tests: acceptance tests

Setup

Python environment

It is recommended to run the code in a virtual environment using at least Python 3.11.

First, check out the code, then create a virtual environment and install the dependencies:

cd climatextract
python -m venv co2_info_extraction
source co2_info_extraction/bin/activate
pip install -e .

If you need to use input_mode = "text+table" (discouraged), also install the table dependencies (and Poppler, see the installation guide):

pip install -e ".[tables]"

See the Installation guide for additional steps and alternative deployment options you have.

Usage

Place your PDF sustainability reports in the data/pdfs/ directory, then run the extraction pipeline:

from climatextract import extract

result_path = extract("./data/pdfs/company_2023_report.pdf")

Results are saved as CSV files in output/<run-id>/. See the Quickstart for more examples.

Configuration

Extraction behavior is controlled via a climatextract.toml file in your working directory. It lets you configure the LLM model, embedding model, prompt type, year range, semantic search parameters, and more. See the Configuration guide for all available options.

Running tests

python -m pytest

See tests/README.md for details on the acceptance test suite.

Documentation

The full documentation is hosted at gist-sustainability.github.io/climatextract and covers usage, configuration, architecture, and API reference:

Section Description
Installation Detailed setup instructions
Quickstart First extraction walkthrough
Configuration All TOML configuration options
Custom Providers Plug in a non-Azure LLM or embedding backend
Architecture Pipeline design and components
Prompts How extraction prompts work
Evaluation Measuring extraction quality
API Reference Public API functions

To build and serve the docs locally:

pip install -e '.[docs]'
mkdocs serve

Metadata

Release files for climatextract 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for climatextract 0.3.4
File Size Uploaded Provenance Actions
climatextract-0.3.4.tar.gz 84.8 kB Without provenance Details for climatextract-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for climatextract 0.3.4
File Interpreter ABI Platform Actions
climatextract-0.3.4-py3-none-any.whl Python 3 none any Details for climatextract-0.3.4-py3-none-any.whl

Total release size: 176.9 kB

Release files / climatextract-0.3.4.tar.gz

Download URL climatextract-0.3.4.tar.gz
Size 84.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c26d375798554630d7ae13b76fdbe479235e7dbeabd3ec8f3638c28b0327b76e
BLAKE2b-256 checksum
How to use checksums
df8f74862be4890418527334e9e57a63c1cfcbf39eaff8646b5cad3883007d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / climatextract-0.3.4-py3-none-any.whl

Download URL climatextract-0.3.4-py3-none-any.whl
Size 92.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9786869ef098a701486a76d807b1201d6ad08efb9ee9564fbbe509df5afd028e
BLAKE2b-256 checksum
How to use checksums
105fa12ad0879d5d46e1d7249c502d4b8fa667847e53cdbd9d00d0164ccdadf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for climatextract 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page