Skip to main content

ChatGPT files

This example goes over how to load conversations.json from your ChatGPT data export folder. You can get your data export by email by going to: ChatGPT -> (Profile) - Settings -> Export data -> Confirm export -> Check email.

Usage, extracting all logs

Example code:

import { ChatGPTLoader } from "langchain/document_loaders/fs/chatgpt";

const loader = new ChatGPTLoader("./example_data/example_conversations.json");

const docs = await loader.load();

console.log(docs);

Usage, extracting a single log

Example code:

import { ChatGPTLoader } from "langchain/document_loaders/fs/chatgpt";

const loader = new ChatGPTLoader(
"./example_data/example_conversations.json",
1
);

const docs = await loader.load();

console.log(docs);

Help us out by providing feedback on this documentation page: