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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db190e465a8c8be24d89947dcd049e615cc9a14269cb43a3ac07e606a3107d6 |
|
MD5 | b285b3c744acd0871c733fe1dcfa4c6c |
|
BLAKE2b-256 | 7a31d303f5a85647c2abed110a3afbe0aba5a001ff42dd8be701713c34e0c754 |
Close
Hashes for llama_index_readers_mongodb-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89e19c2a802d428ccc91d9d293124c6aaef87ece3b22c92bb0ca771ef655307d |
|
MD5 | fb3fb5305821e534def6cdff551c5ec3 |
|
BLAKE2b-256 | 431dfa538edeac0ce97e21b925bf7eaedf4d78b08259bc578575654c3fad70fc |