[Refactor] Update dependencies and loaders (#1062)

This commit is contained in:
Sidharth Mohanty
2023-12-30 20:52:20 +05:30
committed by GitHub
parent a304ded500
commit aee5bbb44b
8 changed files with 350 additions and 294 deletions

View File

@@ -1,7 +1,6 @@
import hashlib
import pytest
from llama_index.readers.schema.base import Document
from embedchain.loaders.json import JSONLoader
@@ -42,8 +41,15 @@ def test_load_data_url(mocker):
mocker.patch("os.path.isfile", return_value=False)
mocker.patch(
"llama_hub.jsondata.base.JSONDataReader.load_data",
return_value=[Document(text="content1"), Document(text="content2")],
"embedchain.loaders.json.JSONReader.load_data",
return_value=[
{
"text": "content1",
},
{
"text": "content2",
},
],
)
mock_response = mocker.Mock()
@@ -98,8 +104,15 @@ def test_load_data_from_json_string(mocker):
mocker.patch("os.path.isfile", return_value=False)
mocker.patch(
"llama_hub.jsondata.base.JSONDataReader.load_data",
return_value=[Document(text="content1"), Document(text="content2")],
"embedchain.loaders.json.JSONReader.load_data",
return_value=[
{
"text": "content1",
},
{
"text": "content2",
},
],
)
result = JSONLoader.load_data(content)