MCPcopy Create free account
hub / github.com/Spinachead/arg / load_vector_store

Method load_vector_store

app/knowledge_base/kb_cache/faiss_cache.py:147–166  ·  view source on GitHub ↗
(
        self,
        kb_name: str,
        embed_model: str = get_default_embedding(),
    )

Source from the content-addressed store, hash-verified

145 """
146
147 def load_vector_store(
148 self,
149 kb_name: str,
150 embed_model: str = get_default_embedding(),
151 ) -> ThreadSafeFaiss:
152 self.atomic.acquire()
153 cache = self.get(kb_name)
154 if cache is None:
155 item = ThreadSafeFaiss(kb_name, pool=self)
156 self.set(kb_name, item)
157 with item.acquire(msg="初始化"):
158 self.atomic.release()
159 # logger.info(f"loading vector store in '{kb_name}' to memory.")
160 # create an empty vector store
161 vector_store = self.new_temp_vector_store(embed_model=embed_model)
162 item.obj = vector_store
163 item.finish_loading()
164 else:
165 self.atomic.release()
166 return self.get(kb_name)
167
168
169kb_faiss_pool = KBFaissPool(cache_num=1)

Callers

nothing calls this directly

Calls 7

get_default_embeddingFunction · 0.90
ThreadSafeFaissClass · 0.85
getMethod · 0.80
setMethod · 0.80
new_temp_vector_storeMethod · 0.80
finish_loadingMethod · 0.80
acquireMethod · 0.45

Tested by

no test coverage detected