-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add ObsidianLoader to Document loaders #3494
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
32840b3
Add ObsidianLoader integration
eactisgrosso 25d408d
Merge remote-tracking branch 'upstream/main'
eactisgrosso ca6dfdb
Fix Notion test not to consider Obsidian '.md' files
eactisgrosso a8b5224
Merge branch 'main' of https://github.com/hwchase17/langchainjs into …
jacoblee93 912027e
Fix lint
jacoblee93 9472b65
Merge branch 'main' of https://github.com/hwchase17/langchainjs into …
jacoblee93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
examples/src/document_loaders/example_data/obsidian/bad_frontmatter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
anArray: | ||
one | ||
- two | ||
- three | ||
tags: 'onetag', 'twotag' ] | ||
--- | ||
|
||
A document with frontmatter that isn't valid. |
5 changes: 5 additions & 0 deletions
5
examples/src/document_loaders/example_data/obsidian/frontmatter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
tags: journal/entry, obsidian | ||
--- | ||
|
||
No other content than the frontmatter. |
13 changes: 13 additions & 0 deletions
13
examples/src/document_loaders/example_data/obsidian/no_frontmatter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
### Description | ||
#recipes #dessert #cookies | ||
|
||
A document with HR elements that might trip up a front matter parser: | ||
|
||
--- | ||
|
||
### Ingredients | ||
|
||
- 3/4 cup (170g) **unsalted butter**, slightly softened to room temperature. | ||
- 1 and 1/2 cups (180g) **confectioners’ sugar** | ||
|
||
--- |
1 change: 1 addition & 0 deletions
1
examples/src/document_loaders/example_data/obsidian/no_metadata.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A markdown document with no additional metadata. |
35 changes: 35 additions & 0 deletions
35
examples/src/document_loaders/example_data/obsidian/tags_and_frontmatter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
aFloat: 13.12345 | ||
anInt: 15 | ||
aBool: true | ||
aString: string value | ||
anArray: | ||
- one | ||
- two | ||
- three | ||
aDict: | ||
dictId1: '58417' | ||
dictId2: 1500 | ||
tags: [ 'onetag', 'twotag' ] | ||
--- | ||
|
||
# Tags | ||
|
||
()#notatag | ||
#12345 | ||
#read | ||
something #tagWithCases | ||
- #tag-with-dash | ||
#tag_with_underscore #tag/with/nesting | ||
|
||
# Dataview | ||
|
||
Here is some data in a [dataview1:: a value] line. | ||
Here is even more data in a (dataview2:: another value) line. | ||
dataview3:: more data | ||
notdataview4: this is not a field | ||
notdataview5: this is not a field | ||
|
||
# Text content | ||
|
||
https://example.com/blog/#not-a-tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ObsidianLoader } from "langchain/document_loaders/fs/obsidian"; | ||
|
||
export const run = async () => { | ||
const loader = new ObsidianLoader( | ||
"src/document_loaders/example_data/obsidian" | ||
); | ||
|
||
const docs = await loader.load(); | ||
|
||
console.log({ docs }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there! 👋 I noticed that this PR introduces a new dependency related to document loading for Obsidian. This change may impact the project's dependencies, so I'm flagging it for the maintainers to review. Great work on the PR! 🚀