-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
langchain[patch],community[patch]: add in-memory option for unstructured loader #5581
Changes from all commits
cd53eb2
9f479d7
dd2d707
e204c3e
55e51e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
import * as url from "node:url"; | ||
import * as path from "node:path"; | ||
import { readFile } from "node:fs/promises"; | ||
import { test, expect } from "@jest/globals"; | ||
import { | ||
UnstructuredDirectoryLoader, | ||
|
@@ -29,6 +30,34 @@ test.skip("Test Unstructured base loader", async () => { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey team, just a heads up that I've flagged a change in the PR related to accessing an environment variable using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's right, I've run the tests locally using a docker instance of unstructured |
||
}); | ||
|
||
test.skip("Test Unstructured base loader with buffer", async () => { | ||
const filePath = path.resolve( | ||
path.dirname(url.fileURLToPath(import.meta.url)), | ||
"./example_data/example.txt" | ||
); | ||
|
||
const options = { | ||
apiKey: process.env.UNSTRUCTURED_API_KEY!, | ||
}; | ||
|
||
const buffer = await readFile(filePath); | ||
const fileName = "example.txt"; | ||
|
||
const loader = new UnstructuredLoader( | ||
{ | ||
buffer, | ||
fileName, | ||
}, | ||
options | ||
); | ||
const docs = await loader.load(); | ||
|
||
expect(docs.length).toBe(3); | ||
for (const doc of docs) { | ||
expect(typeof doc.pageContent).toBe("string"); | ||
} | ||
}); | ||
|
||
test.skip("Test Unstructured base loader with fast strategy", async () => { | ||
const filePath = path.resolve( | ||
path.dirname(url.fileURLToPath(import.meta.url)), | ||
|
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.
We reeealy need to clean this up 😬