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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a38b6397a46698f382de5df0b00d4f27e786caa87aad614d2e322e8a812ae6d |
|
MD5 | 772dd79519882b25122003badaf88951 |
|
BLAKE2b-256 | 96ce71b54f834017c2621a0df874610569e13b8508f1fc0ebff192329bda19c0 |
Close
Hashes for llama_index_readers_mongodb-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f052bab66e77b3888fa491af4fc9d42e62425711e61d8c9a437669a6eadffd |
|
MD5 | 8d280894c8290cfdc6fd1bc236aad7d5 |
|
BLAKE2b-256 | 6bdc4c767c100041e57e769ee359962918967952471a3d58c59ec5d39e5643a2 |