Find answers from the community

Updated 10 months ago

just needed to ask a question on the

At a glance
just needed to ask a question on the below error:
TypeError: KVDocumentStore.init() got an unexpected keyword argument 'node_collection_suffix'

the code is :
from llama_index.core import SimpleDirectoryReader, StorageContext
from llama_index.core import VectorStoreIndex, SimpleKeywordTableIndex
from llama_index.core import SummaryIndex
from llama_index.core import ComposableGraph
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings
import os
from dotenv import load_dotenv

load_dotenv()
reader = SimpleDirectoryReader("./Data_1/")
documents = reader.load_data()

from llama_index.core.node_parser import SentenceSplitter

nodes = SentenceSplitter().get_nodes_from_documents(documents)

mongo_uri = os.getenv("MONGO_URI")

from llama_index.storage.docstore.mongodb import MongoDocumentStore
from llama_index.storage.index_store.mongodb import MongoIndexStore

storage_context = StorageContext.from_defaults(
docstore=MongoDocumentStore.from_uri(uri=mongo_uri),
index_store=MongoIndexStore.from_uri(uri=mongo_uri),
)
storage_context.docstore.add_documents(nodes)
L
V
4 comments
Not sure why its raising that error, thats definitely a valid kwarg to KVDocumentStore

Maybe try pip install -U llama-index-core llama-index-storage-docstore-mongodb
Attachment
image.png
Thank you Logan, it is working fine now
Add a reply
Sign up and join the conversation on Discord