from llama_index import VectorStoreIndex index = VectorStoreIndex.from_documents(documents, storage_context=storage_context, service_context=service_context, show_progress=True)
AttributeError: 'str' object has no attribute 'get_doc_id'
def load_documents(self, file_paths): """ Load documents from a list of file paths. This function takes a list of file paths, reads each file, and stores its contents in a dictionary. The keys of the dictionary are the file paths, and the values are the contents of the files. Parameters: file_paths (list): A list of file paths to load. Returns: dict: A dictionary where each key is a file path and each value is the content of the corresponding file. """ documents = {} for file in file_paths: documents[file] = SimpleDirectoryReader(input_files=[file]).load_data() return documents
{'file_path/file.txt' : [Document(id=..., embedding=None, metadata={... }}
reader = SimpleDirectoryReader( input_files=file_paths, ) return reader.load_data()