本页还没有译文
本页 16 段还没译成Español,下面显示的是英文原文。TextLoader integration
还没翻译译自英文(docs.langchain.com)本页 16 段都还没译
Tip
Compatibility: Only available on Node.js.
This notebook provides a quick overview for getting started with TextLoader document loaders. For detailed documentation of all TextLoader features and configurations head to the API reference.
Overview
Integration details
| Class | Package | Compatibility | Local | PY support |
|---|---|---|---|---|
TextLoader | langchain | Node-only | ✅ | ❌ |
Setup
To access TextLoader document loader you'll need to install the langchain package.
Installation
The LangChain TextLoader integration lives in the langchain package:
npm install langchainyarn add langchainpnpm add langchainInstantiation
Now we can instantiate our model object and load documents:
import { TextLoader } from "@langchain/classic/document_loaders/fs/text"
const loader = new TextLoader("../../../../../../examples/src/document_loaders/example_data/example.txt")Load
const docs = await loader.load()
docs[0]Document {
pageContent: 'Foo\nBar\nBaz\n\n',
metadata: {
source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
},
id: undefined
}console.log(docs[0].metadata){
source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
}API reference
For detailed documentation of all TextLoader features and configurations head to the API reference.
AI 翻译查看英文原文