MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _load_store

Function _load_store

scripts/afml_mcp_server.py:51–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50
51def _load_store() -> IndexStore:
52 global _STORE
53 if _STORE is not None:
54 return _STORE
55
56 index_dir = _get_index_dir()
57 manifest = json.loads((index_dir / "manifest.json").read_text(encoding="utf-8"))
58
59 chunks: list[dict[str, Any]] = []
60 with (index_dir / "chunks.jsonl").open("r", encoding="utf-8") as f:
61 for line in f:
62 chunks.append(json.loads(line))
63
64 embeddings = np.load(index_dir / "embeddings.npy")
65 chunk_id_to_idx = {c["chunk_id"]: i for i, c in enumerate(chunks)}
66
67 _STORE = IndexStore(
68 index_dir=index_dir,
69 chunks=chunks,
70 embeddings=embeddings,
71 manifest=manifest,
72 chunk_id_to_idx=chunk_id_to_idx,
73 )
74 return _STORE
75
76
77def _load_model(model_name: str):

Callers 4

_score_resultsFunction · 0.85
_chunk_with_neighborsFunction · 0.85
afml_index_infoFunction · 0.85
afml_list_chaptersFunction · 0.85

Calls 3

_get_index_dirFunction · 0.85
IndexStoreClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected