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
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
File details
Details for the file llama_index_readers_mongodb-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_mongodb-0.3.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d625f96d69ea8e7db214c008a591c0159e9c7c4d22479e2f366774e045dc3297 |
|
MD5 | 1f38b1f88763058e908fefdffddb49ec |
|
BLAKE2b-256 | 04e3c301a7c64bcf2c2f4b89770f295a0ee091126b0a8aacd2bff40be04bed14 |
File details
Details for the file llama_index_readers_mongodb-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_mongodb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ae0290a5f075b6c0cc1226a58144c25a30d3d6fad841cabb190362ef020e42d |
|
MD5 | eb83ad4c32b96ba53d81eb2767398b72 |
|
BLAKE2b-256 | 47dbe06ac07cf7371f4c9d4712d022bdc7f05c64d486901fd145eb1a06c61475 |