repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import hashlib |
| #2 | |
| #3 | from embedchain.helpers.json_serializable import register_deserializable |
| #4 | from embedchain.loaders.base_loader import BaseLoader |
| #5 | |
| #6 | |
| #7 | @register_deserializable |
| #8 | class LocalQnaPairLoader(BaseLoader): |
| #9 | def load_data(self, content): |
| #10 | """Load data from a local QnA pair.""" |
| #11 | question, answer = content |
| #12 | content = f"Q: {question}\nA: {answer}" |
| #13 | url = "local" |
| #14 | metadata = {"url": url, "question": question} |
| #15 | doc_id = hashlib.sha256((content + url).encode()).hexdigest() |
| #16 | return { |
| #17 | "doc_id": doc_id, |
| #18 | "data": [ |
| #19 | { |
| #20 | "content": content, |
| #21 | "meta_data": metadata, |
| #22 | } |
| #23 | ], |
| #24 | } |
| #25 |