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.mongo 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for llama_index_readers_mongodb-0.1.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ccf88127e5eb0c52c75f8c9b55b0593387d39a92261e003643e7bc5a6760bcf |
|
MD5 | 59edeee5d0985177c6bd2bf86ec4ec69 |
|
BLAKE2b-256 | 4656e3975b80d4517e023c7c5ee2054d25d5b4f9522037a5adbc0b713a81fd87 |
Close
Hashes for llama_index_readers_mongodb-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de62bcaa6f1e38e8247d68882b7d5407af6df0f769c5b91fa4213ec0f52eea2e |
|
MD5 | 4eb65923e3e432d4b536984877f9cd0e |
|
BLAKE2b-256 | ac0ddcd454436da9ba54ed08732d850a0dc03f0372927f80379fa59b4792c26d |