feat: add local qna pair
This commit is contained in:
0
embedchain/loaders_local/__init__.py
Normal file
0
embedchain/loaders_local/__init__.py
Normal file
16
embedchain/loaders_local/qna_pair.py
Normal file
16
embedchain/loaders_local/qna_pair.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from embedchain.utils import markdown_to_plaintext
|
||||
|
||||
|
||||
class QnaPairLoader:
|
||||
|
||||
def load_data(self, content):
|
||||
question, answer = content
|
||||
answer = markdown_to_plaintext(answer)
|
||||
content = f"Q: {question}\nA: {answer}"
|
||||
meta_data = {
|
||||
"url": "local",
|
||||
}
|
||||
return [{
|
||||
"content": content,
|
||||
"meta_data": meta_data,
|
||||
}]
|
||||
Reference in New Issue
Block a user