Class: Langchain::Processors::JSONL

Inherits:
Base
  • Object
show all
Defined in:
lib/langchain/processors/jsonl.rb

Constant Summary collapse

EXTENSIONS =
[".jsonl"]
CONTENT_TYPES =
["application/jsonl", "application/json-lines", "application/jsonlines"]

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from DependencyHelper

#depends_on

Constructor Details

This class inherits a constructor from Langchain::Processors::Base

Instance Method Details

#parse(data) ⇒ Array of Hash

Parse the document and return the text

Parameters:

  • data (File)

Returns:

  • (Array of Hash)


12
13
14
15
16
# File 'lib/langchain/processors/jsonl.rb', line 12

def parse(data)
  data.read.lines.map do |line|
    ::JSON.parse(line)
  end
end