feat: Add embedding manager (#570)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import hashlib
|
||||
|
||||
from embedchain.helper.json_serializable import register_deserializable
|
||||
from embedchain.loaders.base_loader import BaseLoader
|
||||
|
||||
@@ -6,12 +8,17 @@ from embedchain.loaders.base_loader import BaseLoader
|
||||
class LocalTextLoader(BaseLoader):
|
||||
def load_data(self, content):
|
||||
"""Load data from a local text file."""
|
||||
url = "local"
|
||||
meta_data = {
|
||||
"url": "local",
|
||||
"url": url,
|
||||
}
|
||||
doc_id = hashlib.sha256((content + url).encode()).hexdigest()
|
||||
return {
|
||||
"doc_id": doc_id,
|
||||
"data": [
|
||||
{
|
||||
"content": content,
|
||||
"meta_data": meta_data,
|
||||
}
|
||||
]
|
||||
}
|
||||
return [
|
||||
{
|
||||
"content": content,
|
||||
"meta_data": meta_data,
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user