-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(llms.json_load): Recursively load json lists (#593)
Slightly broken json are protected against by the function `ragas.llms.json_load.JsonLoader._find_outermost_json`. However, I've found that for many metrics, gpt4 can often return slightly broken json lists, for which this function returns only the first valid json. Here we wrap `_find_outermost_json` with `_load_all_jsons` which calls it recursively to load the full json list. I.e. expected output for `'{"1":"2"}, ,, {"3":"4"}]'` is `[{'1': '2'}, {'3': '4'}]` --------- Co-authored-by: jjmachan <[email protected]>
- Loading branch information
1 parent
3834fe5
commit 27e1c24
Showing
3 changed files
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters