Skip to content

Commit

Permalink
fix: jsondata loader on library (run-llama#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanuelCampos authored Sep 27, 2023
1 parent 6bf1153 commit 6a14dd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llama_hub/jsondata/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _depth_first_yield(json_data: Dict, path: List[str]) -> Generator[str, None,
yield " ".join(path)


class JSONDataReader(BaseReader):
class JsonDataReader(BaseReader):
"""Json Data reader.
Reads in Json Data.
Expand All @@ -52,3 +52,7 @@ def load_data(self, input_data: Union[str, Dict]) -> List[Document]:
lines = json_output.split("\n")
useful_lines = [line for line in lines if not re.match(r"^[{}\[\],]*$", line)]
return [Document(text="\n".join(useful_lines))]


# legacy
JSONDataReader = JsonDataReader
4 changes: 4 additions & 0 deletions llama_hub/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
"id": "file/json",
"author": "yisding"
},
"JsonDataReader": {
"id": "jsondata",
"author": "jerryjliu"
},
"MarkdownReader": {
"id": "file/markdown",
"author": "hursh-desai"
Expand Down

0 comments on commit 6a14dd7

Please sign in to comment.