MCPcopy Create free account
hub / github.com/DVampire/FinAgent / __init__

Method __init__

finagent/memory/faiss.py:43–64  ·  view source on GitHub ↗

Initialize the Meta Faiss vectorstore. Code modified based on langchain. Args: embedding_provider: Embedding provider. memory_path: Path to the store memory. index: Faiss index. index_to_key: Mapping from index to key.

(
        self,
        embedding_dim: int,
        memory_path: str,
        index: Optional[Any] = None,
        index_to_key: Optional[Dict[int, str]] = None,
    )

Source from the content-addressed store, hash-verified

41
42class FAISS(VectorStore):
43 def __init__(
44 self,
45 embedding_dim: int,
46 memory_path: str,
47 index: Optional[Any] = None,
48 index_to_key: Optional[Dict[int, str]] = None,
49 ) -> None:
50 """Initialize the Meta Faiss vectorstore.
51 Code modified based on langchain.
52
53 Args:
54 embedding_provider: Embedding provider.
55 memory_path: Path to the store memory.
56 index: Faiss index.
57 index_to_key: Mapping from index to key.
58 """
59 faiss = dependable_faiss_import()
60 if index is None:
61 self.index = faiss.IndexFlatL2(embedding_dim)
62 if index_to_key is None:
63 self.index_to_key = {}
64 self.memory_path = memory_path
65
66 def add_embeddings(
67 self,

Callers

nothing calls this directly

Calls 1

dependable_faiss_importFunction · 0.85

Tested by

no test coverage detected