Spaces:
Sleeping
Sleeping
Download runtime/live_state.py from G-ACE/astera-customerAI: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/G-ACE/astera-customerAI/resolve/main/runtime/live_state.py
- Command line
-
hf download hf://spaces/G-ACE/astera-customerAI/runtime/live_state.py
-
curl -L -o live_state.py https://huggingface.co/spaces/G-ACE/astera-customerAI/resolve/main/runtime/live_state.py
1.03 kB
| from __future__ import annotations | |
| from pathlib import Path | |
| from .kb_search import LocalHybridKnowledgeStore | |
| from .schemas import GroundedFact, NeedTask | |
| class EmptyLiveStateProvider: | |
| async def current_facts(self, tasks: list[NeedTask]) -> list[GroundedFact]: | |
| return [] | |
| class HybridLiveStateProvider: | |
| """NeedTask-scoped Current/Live fact retrieval using the same local hybrid index contract.""" | |
| def __init__(self, store: LocalHybridKnowledgeStore): | |
| self.store = store | |
| def from_jsonl( | |
| cls, | |
| path: str | Path, | |
| *, | |
| generation_id: str, | |
| ) -> "HybridLiveStateProvider": | |
| return cls( | |
| LocalHybridKnowledgeStore.from_jsonl( | |
| path, | |
| generation_id=generation_id, | |
| ) | |
| ) | |
| async def current_facts(self, tasks: list[NeedTask]) -> list[GroundedFact]: | |
| facts = await self.store.find_for_tasks(tasks) | |
| return [fact for fact in facts if fact.authority in {"current", "live"}] | |