Skip to main content

RAG dataset generator

Project description

RAGGen - RAG Dataset Generator

A universal tool for converting files into high-quality RAG datasets.

Features

  • Supports a variety of commonly used formats for storing textual data.
  • Robust PDF parsing with OCR utilizing marker library.
  • Preserves headers, supports fixing header levels using LLM (OpenAI API).
  • Respects tables, does not split them into chunks.
  • Supports embedding metadata directly into chunk text.
  • Supports adding custom metadata for each input.
  • Multiple outputs formats including pandas DataFrames and Langchain documents.
  • Checksum-based result caching.

Supported formats

Installation

pip install raggen

Usage

from raggen import RAGGen, RAGInput

# Initialize RAGGen
gen = RAGGen(cache_dir="cache")

# Define inputs
inputs = ["sample1.pdf", "sample2.html", "sample3.md"]

# Input with custom metadata
inputs.append(RAGInput(
    path = "sample4.docx",
    metadata = {"title": "Doc title"}
))

# Generate RAG dataset as list
data = gen(inputs, output_format="df", flatten=True)

TODO

  • Save images
  • Add proper documentation
  • Add more usage examples
  • Add txt support
  • Add Power Point support
  • Add Excel support
  • Add support for reading files from buffer

Contribution

Feel free to fork this repo and make pull requests.

If you like my work, please, support me:

BTC: 32F3zAnQQGwZzsG7R35rPUS269Xz11cZ8B

Lisense

Free to use under Apache-2.0. See LICENSE for more information.

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

raggen-0.1.5.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raggen-0.1.5-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file raggen-0.1.5.tar.gz.

File metadata

  • Download URL: raggen-0.1.5.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for raggen-0.1.5.tar.gz
Algorithm Hash digest
SHA256 728e9ae2df62e9902c6a0b1f36f83548787f45bdc20282ca9a85d53402fc5fdc
MD5 ebc3ee04169a23a63f7abdc2dc9fbd2a
BLAKE2b-256 d998035a686310e8bdc82e1a81a36ab69c15c0757580a97d0539969a1dcc22fe

See more details on using hashes here.

File details

Details for the file raggen-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: raggen-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for raggen-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0a6ba5234c5ef3bdfd177b2cba18d436e6da512e752c75d12e346faafc398fc2
MD5 4e212202ace6d2fd8b75a34418de0382
BLAKE2b-256 6c9d2d7108904fccee779f2b09f35fa6fc4cae4f716274f30fa8a93381e63b24

See more details on using hashes here.

Supported by

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