MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _load_cached

Method _load_cached

skills/embedding/scripts/embed.py:366–379  ·  view source on GitHub ↗
(self, text: str)

Source from the content-addressed store, hash-verified

364 return self.cache_dir / f"{self._cache_key(text)}.json"
365
366 def _load_cached(self, text: str) -> Optional[List[float]]:
367 cache_path = self._cache_path(text)
368 if not cache_path.exists():
369 return None
370
371 try:
372 data = json.loads(cache_path.read_text(encoding="utf-8"))
373 except (json.JSONDecodeError, OSError):
374 return None
375
376 embedding = data.get("embedding")
377 if not isinstance(embedding, list):
378 return None
379 return embedding
380
381 def _save_cached(self, text: str, embedding: List[float]) -> None:
382 cache_path = self._cache_path(text)

Callers 2

embed_textMethod · 0.95
embed_batchMethod · 0.95

Calls 2

_cache_pathMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected