Documentation Index
Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
Use this file to discover all available pages before exploring further.
本示例介绍了如何从 JSONLines 或 JSONL 文件中加载数据。第二个参数是一个 JSONPointer,指向要从文件中每个 JSON 对象提取的属性。文件中的每个 JSON 对象都将创建一个文档。
示例 JSONLines 文件:
{"html": "This is a sentence."}
{"html": "This is another sentence."}
示例代码:
import { JSONLinesLoader } from "@langchain/classic/document_loaders/fs/json";
const loader = new JSONLinesLoader(
"src/document_loaders/example_data/example.jsonl",
"/html"
);
const docs = await loader.load();
/*
[
Document {
"metadata": {
"blobType": "application/jsonl+json",
"line": 1,
"source": "blob",
},
"pageContent": "This is a sentence.",
},
Document {
"metadata": {
"blobType": "application/jsonl+json",
"line": 2,
"source": "blob",
},
"pageContent": "This is another sentence.",
},
]
*/