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.",
},
]
*/
더 알아보기
- 이 문서를 MCP로 연결하면 Claude, VSCode 등에서 실시간 답변을 받을 수 있어요.
- GitHub에서 이 페이지 편집하기 또는 이슈 제출하기.