Skip to main content

llama-index readers mongodb integration

Project description

LlamaIndex Readers Integration: Mongo

Overview

Simple Mongo Reader allows loading data from a MongoDB database. It concatenates specified fields from each document into a single document used by LlamaIndex.

Installation

You can install MongoDB Reader via pip:

pip install llama-index-readers-mongodb

Usage

from llama_index.readers.mongodb import SimpleMongoReader

# Initialize SimpleMongoReader
reader = SimpleMongoReader(
    host="<Mongo Host>",  # Mongo host address
    port=27017,  # Mongo port (default: 27017)
    uri="<Mongo Connection String>",  # Provide the URI if not using host and port
)

# Lazy load data from MongoDB
documents = reader.lazy_load_data(
    db_name="<Database Name>",  # Name of the database
    collection_name="<Collection Name>",  # Name of the collection
    field_names=[
        "text"
    ],  # Names of the fields to concatenate (default: ["text"])
    separator="",  # Separator between fields (default: "")
    query_dict=None,  # Query to filter documents (default: None)
    max_docs=0,  # Maximum number of documents to load (default: 0)
    metadata_names=None,  # Names of the fields to add to metadata attribute (default: None)
)

Implementation for MongoDB reader can be found here

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.

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_mongodb-0.3.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

llama_index_readers_mongodb-0.3.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_readers_mongodb-0.3.2.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_mongodb-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6f9dcbf4365887b5f79a16107f9ff5dc4430a0c92d6b21845c86228c8aeefc4a
MD5 f7887727ec2976f97dcae810c65eabd1
BLAKE2b-256 536e71b8a78198d730dcfb60e232e9d5f66e7c6c67327cbf1feee25f3495d8b8

See more details on using hashes here.

File details

Details for the file llama_index_readers_mongodb-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_mongodb-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3d6032d70ce802c6103fc7c1bf9a7820ca585a5e509d6fa148a039d757eb0ea6
MD5 f520748dd9160dbbd5c2dc6a4e583b72
BLAKE2b-256 6a49cc20c14adc232f1e4365598032f2df1321917457fc947b9fe782fab71616

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