Skip to content
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 6 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api_refs/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"./langchain/src/document_loaders/fs/epub.ts",
"./langchain/src/document_loaders/fs/csv.ts",
"./langchain/src/document_loaders/fs/notion.ts",
"./langchain/src/document_loaders/fs/obsidian.ts",
"./langchain/src/document_loaders/fs/unstructured.ts",
"./langchain/src/document_loaders/fs/openai_whisper_audio.ts",
"./langchain/src/document_loaders/fs/pptx.ts",
Expand Down
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tags: journal/entry, obsidian
---

No other content than the frontmatter.
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**

---
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A markdown document with no additional metadata.
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
11 changes: 11 additions & 0 deletions examples/src/document_loaders/obsidian.ts
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 });
};
3 changes: 3 additions & 0 deletions langchain/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ document_loaders/fs/csv.d.ts
document_loaders/fs/notion.cjs
document_loaders/fs/notion.js
document_loaders/fs/notion.d.ts
document_loaders/fs/obsidian.cjs
document_loaders/fs/obsidian.js
document_loaders/fs/obsidian.d.ts
document_loaders/fs/unstructured.cjs
document_loaders/fs/unstructured.js
document_loaders/fs/unstructured.d.ts
Expand Down
8 changes: 8 additions & 0 deletions langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@
"document_loaders/fs/notion.cjs",
"document_loaders/fs/notion.js",
"document_loaders/fs/notion.d.ts",
"document_loaders/fs/obsidian.cjs",
"document_loaders/fs/obsidian.js",
"document_loaders/fs/obsidian.d.ts",
"document_loaders/fs/unstructured.cjs",
"document_loaders/fs/unstructured.js",
"document_loaders/fs/unstructured.d.ts",
Expand Down Expand Up @@ -2241,6 +2244,11 @@
"import": "./document_loaders/fs/notion.js",
Copy link

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! 🚀

"require": "./document_loaders/fs/notion.cjs"
},
"./document_loaders/fs/obsidian": {
"types": "./document_loaders/fs/obsidian.d.ts",
"import": "./document_loaders/fs/obsidian.js",
"require": "./document_loaders/fs/obsidian.cjs"
},
"./document_loaders/fs/unstructured": {
"types": "./document_loaders/fs/unstructured.d.ts",
"import": "./document_loaders/fs/unstructured.js",
Expand Down
2 changes: 2 additions & 0 deletions langchain/scripts/create-entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const entrypoints = {
"document_loaders/fs/epub": "document_loaders/fs/epub",
"document_loaders/fs/csv": "document_loaders/fs/csv",
"document_loaders/fs/notion": "document_loaders/fs/notion",
"document_loaders/fs/obsidian": "document_loaders/fs/obsidian",
"document_loaders/fs/unstructured": "document_loaders/fs/unstructured",
"document_loaders/fs/openai_whisper_audio":
"document_loaders/fs/openai_whisper_audio",
Expand Down Expand Up @@ -451,6 +452,7 @@ const requiresOptionalDependency = [
"document_loaders/fs/epub",
"document_loaders/fs/csv",
"document_loaders/fs/notion",
"document_loaders/fs/obsidian",
"document_loaders/fs/unstructured",
"document_loaders/fs/openai_whisper_audio",
"document_loaders/fs/pptx",
Expand Down
Loading