mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 18:36:22 +02:00
Merge pull request #37 from send18/feature-faiss
faiss init with kwargs
This commit is contained in:
commit
1a37277df2
1 changed files with 3 additions and 2 deletions
|
|
@ -20,9 +20,10 @@ from metagpt.logs import logger
|
|||
|
||||
|
||||
class FaissStore(LocalStore):
|
||||
def __init__(self, raw_data: Path, cache_dir=None, meta_col="source", content_col="output"):
|
||||
def __init__(self, raw_data: Path, cache_dir=None, meta_col="source", content_col="output", embedding_conf=None):
|
||||
self.meta_col = meta_col
|
||||
self.content_col = content_col
|
||||
self.embedding_conf = embedding_conf or {}
|
||||
super().__init__(raw_data, cache_dir)
|
||||
|
||||
def _load(self) -> Optional["FaissStore"]:
|
||||
|
|
@ -37,7 +38,7 @@ class FaissStore(LocalStore):
|
|||
return store
|
||||
|
||||
def _write(self, docs, metadatas):
|
||||
store = FAISS.from_texts(docs, OpenAIEmbeddings(openai_api_version="2020-11-07"), metadatas=metadatas)
|
||||
store = FAISS.from_texts(docs, OpenAIEmbeddings(openai_api_version="2020-11-07", **self.embedding_conf), metadatas=metadatas)
|
||||
return store
|
||||
|
||||
def persist(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue