You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched existing ideas and did not find a similar one
I added a very descriptive title
I've clearly described the feature request and motivation for it
Feature request
Add support to YAML loader in document loaders, similar to JSONLoader .
class YAMLLoader(BaseLoader):
"""Load and parse a YAML file into a Document."""
def __init__(self, file_path: Union[str, Path]):
"""Initialize with the file path."""
self.file_path = file_path
def load(self) -> List[Document]:
# Open the YAML file and load its content
with open(self.file_path, "r") as file:
try:
# Load the YAML content
data = yaml.safe_load(file)
except yaml.YAMLError as e:
print(f"Error loading YAML file {self.file_path}: {e}")
# Define metadata with file path information
metadata = {"source": str(self.file_path)}
# Return the loaded content as a list of Documents
return [Document(page_content=text, metadata=metadata)]
Motivation
I was working on a small project and couldn't find a YAML loader in document loaders. Please let me know if we can add this I’d be happy to work on it
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
Add support to YAML loader in document loaders, similar to JSONLoader .
Motivation
I was working on a small project and couldn't find a YAML loader in document loaders. Please let me know if we can add this I’d be happy to work on it
Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions