Jsonlines 파일 통합

Jsonlines 파일 통합

LangChain JavaScript로 Jsonlines 파일 문서 로더와 통합하는 방법을 안내할게요.

출처: 문서

본문

이 예제는 JSONLines 또는 JSONL 파일에서 데이터를 로드하는 방법을 다뤄요. 두 번째 인자는 파일의 각 JSON 객체에서 추출할 속성을 가리키는 JSONPointer예요. 파일의 각 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.",
  },
]
*/

[Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers. [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/file_loaders/jsonlines.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).

더 알아보기