Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

ValueError Load .md file format using Langchain DirectoryLoader

FarahAmirah
Level 1
ValueError Load .md file format using Langchain DirectoryLoader

Hi, I was trying to read .md file format using Langchain library DirectoryLoader.

Here's the code.

import dataiku
import os
from langchain.document_loaders import DirectoryLoader

FILE_NAME = "alice_in_wonderland.md"

# Load the file and split it into smaller chunks
docs_folder = dataiku.Folder("file1") # Replace with your input folder id
file_path = os.path.join(docs_folder.get_path(),
FILE_NAME)
loader = DirectoryLoader(file_path)
doc = loader.load()

 

can you help?

md1.png


Operating system used: Almalinux (8.9)

0 Kudos
1 Reply
Turribeach

The error is pretty clear, the package expects a directory path not a file path. Try passing a directory.

0 Kudos