Spaces:
Configuration error
Configuration error
Download src/cache/context.py from Yash030/agentcache: direct link, hf CLI and curl.
- Browser
- Download file 977 Bytes
-
https://huggingface.co/spaces/Yash030/agentcache/resolve/7c69c77cb080b99bed47bd123723b18f8ecbab14/src/cache/context.py
- Command line
-
hf download hf://spaces/Yash030/agentcache@7c69c77cb080b99bed47bd123723b18f8ecbab14/src/cache/context.py
-
curl -L -o context.py https://huggingface.co/spaces/Yash030/agentcache/resolve/7c69c77cb080b99bed47bd123723b18f8ecbab14/src/cache/context.py
977 Bytes
| """ | |
| src/memory/context.py β Context compilation, export, and index rebuilding. | |
| Public API: | |
| context(kv, data) β compile token-budgeted context for a session/project | |
| export_data(kv, data) β export all folder observations + memories as JSON | |
| rebuild_index(kv) β cold-rebuild BM25/vector index from KV store | |
| """ | |
| from __future__ import annotations | |
| from typing import Any, Dict | |
| from db import StateKV | |
| import functions as _fn | |
| def context(kv: StateKV, data: Dict[str, Any]) -> Dict[str, Any]: | |
| """Assemble context for a session: slots β profile β lessons β past summaries.""" | |
| return _fn.context(kv, data) | |
| def export_data(kv: StateKV, data: Dict[str, Any]) -> Dict[str, Any]: | |
| """Export all folder observations and global memories as JSON (v2 format).""" | |
| return _fn.export_data(kv, data) | |
| def rebuild_index(kv: StateKV) -> int: | |
| """Rebuild BM25/vector index from all KV observations and memories.""" | |
| return _fn.rebuild_index(kv) | |