Json
JSONReader #
Bases: BaseReader
JSON reader.
Reads JSON documents with options to help us out relationships between nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
levels_back
|
int
|
the number of levels to go back in the JSON tree, 0 if you want all levels. If levels_back is None, then we just format the JSON and make each line an embedding |
None
|
collapse_length
|
int
|
the maximum number of characters a JSON fragment would be collapsed in the output (levels_back needs to be not None) ex: if collapse_length = 10, and input is {a: [1, 2, 3], b: {"hello": "world", "foo": "bar"}} then a would be collapsed into one line, while b would not. Recommend starting around 100 and then adjusting from there. |
None
|
is_jsonl
|
Optional[bool]
|
If True, indicates that the file is in JSONL format. |
False
|
clean_json
|
Optional[bool]
|
If True, lines containing only JSON structure are removed. |
True
|
Source code in llama-index-integrations/readers/llama-index-readers-json/llama_index/readers/json/base.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
load_data #
load_data(input_file: str, extra_info: Optional[Dict] = {}) -> List[Document]
Load data from the input file.
Source code in llama-index-integrations/readers/llama-index-readers-json/llama_index/readers/json/base.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|