Skip to main content

llama-index readers structured_data integration

Project description

LlamaIndex Readers Integration: Structured-Data

The function 'StructuredDataReader' supports reading files in JSON, JSONL, CSV, and XLSX formats. It provides parameters 'col_index' and 'col_metadata' to differentiate between columns that should be written into the document's main text and additional metadata.

Install package

pip install llama-index-readers-structured-data

Or install locally:

pip install -e llama-index-integrations/readers/llama-index-readers-structured-data

Usage

  1. for single document:
from pathlib import Path
from llama_index.readers.structured_data.base import StructuredDataReader

parser = StructuredDataReader(col_index=["col1", "col2"], col_metadata=0)
documents = parser.load_data(Path("your/file/path.json"))
  1. for dictory of documents:
from pathlib import Path
from llama_index.core import SimpleDirectoryReader
from llama_index.readers.structured_data.base import StructuredDataReader

parser = StructuredDataReader(col_index=[1, -1], col_metadata="col3")
file_extractor = {
    ".xlsx": parser,
    ".csv": parser,
    ".json": parser,
    ".jsonl": parser,
}
documents = SimpleDirectoryReader(
    "your/dic/path", file_extractor=file_extractor
).load_data()

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

llama_index_readers_structured_data-0.4.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file llama_index_readers_structured_data-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_structured_data-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4e688d96fcf5945037e7fac36f2989d6d8598f114c6906892e6b5f2ec29bdf30
MD5 2927e7ee32f8dba50417f363e992764b
BLAKE2b-256 3c6d3d747598e67eadcc19045e6bd5fae7e6a56c3c20bfc0b2915c30124c2bdc

See more details on using hashes here.

File details

Details for the file llama_index_readers_structured_data-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_structured_data-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db7c5aac75b4f9f932d01686c61a3e655ef030ff2fa4a86bec6f33e9da4c7b62
MD5 639e7d99db35371e030defb2a2799d37
BLAKE2b-256 29a6fba7394da8939d48f0dbb597f1276cbeb4cfe2dfc8e1d12727dfbf1c56ee

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