-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathingest.py
More file actions
36 lines (25 loc) · 840 Bytes
/
ingest.py
File metadata and controls
36 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import logging
import os
from pydantic import TypeAdapter
from kaig.definitions import OriginalDocument
from knowledge_graph import flow
from knowledge_graph.ingestion import files
OriginalDocumentTA = TypeAdapter(OriginalDocument)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
db_ns = os.environ.get("SURREALDB_NAMESPACE", "test")
db_name = os.environ.get("SURREALDB_DATABASE", "test")
async def main() -> None:
db = init_kaig(ns=db_ns, db=db_name)
db.apply_schemas()
exe: flow.Executor = flow.Executor(db)
print("Starting ingestion loop...")
await files.ingestion_loop(exe)
if __name__ == "__main__":
import asyncio
from knowledge_graph.db import init_kaig
try:
asyncio.run(main())
except KeyboardInterrupt:
pass