File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,16 @@ def load_json(json_path):
285
285
return content_list
286
286
287
287
288
+ def load_jsonl (jsonl_path ):
289
+ """Load and process jsonl file."""
290
+ content_list = []
291
+ with open (jsonl_path , "r" ) as file :
292
+ for line in file :
293
+ json_obj = json .loads (line )
294
+ content_list .append (json_obj )
295
+ return content_list
296
+
297
+
288
298
def load_yaml (yaml_path ):
289
299
"""Load and process yaml file."""
290
300
with open (yaml_path , "r" ) as file :
@@ -351,8 +361,10 @@ def document_loader(doc_path):
351
361
return load_md (doc_path )
352
362
elif doc_path .endswith (".xml" ):
353
363
return load_xml (doc_path )
354
- elif doc_path .endswith (".json" ) or doc_path . endswith ( ".jsonl" ) :
364
+ elif doc_path .endswith (".json" ):
355
365
return load_json (doc_path )
366
+ elif doc_path .endswith (".jsonl" ):
367
+ return load_jsonl (doc_path )
356
368
elif doc_path .endswith (".yaml" ):
357
369
return load_yaml (doc_path )
358
370
elif doc_path .endswith (".xlsx" ) or doc_path .endswith (".xls" ):
You can’t perform that action at this time.
0 commit comments