Skip to content

Commit

Permalink
shift args for json reader (run-llama#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryjliu authored Mar 6, 2023
1 parent 5517fed commit 9bb46b3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gpt_index/readers/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ class JSONReader(BaseReader):
"""

def __init__(self, input_file: str, levels_back: Optional[int] = None) -> None:
def __init__(self, levels_back: Optional[int] = None) -> None:
"""Initialize with arguments."""
super().__init__()

self.input_file = input_file
self.levels_back = levels_back

def load_data(self) -> List[Document]:
def load_data(self, input_file: str) -> List[Document]:
"""Load data from the input file."""
with open(self.input_file, "r") as f:
with open(input_file, "r") as f:
data = json.load(f)
if self.levels_back is None:
# If levels_back isn't set, we just format and make each
Expand Down

0 comments on commit 9bb46b3

Please sign in to comment.