Spaces:
No application file
No application file
File size: 497 Bytes
2be9eb9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from utils.pipeline import RAGPipeline
class SessionDB:
data: dict[str, RAGPipeline] = {}
def add(self, key: str, value: RAGPipeline) -> None:
if key in self.data:
raise Exception("Already exists")
self.data[key] = value
def get(self, key: str) -> RAGPipeline:
try:
return self.data[key]
except KeyError:
raise Exception(f"Not found for {key}")
def remove(self, key: str) -> None:
self.data.pop(key)
|