langchain_community.document_loaders.chatgpt.ChatGPTLoader¶

class langchain_community.document_loaders.chatgpt.ChatGPTLoader(log_file: str, num_logs: int = - 1)[source]¶

Load conversations from exported ChatGPT data.

Initialize a class object.

Parameters
  • log_file – Path to the log file

  • num_logs – Number of logs to load. If 0, load all logs.

Methods

__init__(log_file[, num_logs])

Initialize a class object.

lazy_load()

A lazy loader for Documents.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(log_file: str, num_logs: int = - 1)[source]¶

Initialize a class object.

Parameters
  • log_file – Path to the log file

  • num_logs – Number of logs to load. If 0, load all logs.

lazy_load() Iterator[Document]¶

A lazy loader for Documents.

load() List[Document][source]¶

Load data into Document objects.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

Load Documents and split into chunks. Chunks are returned as Documents.

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using ChatGPTLoader¶