Jackson
07/18/2023, 6:54 AMclass VectorStore:
def __init__(
self,
client_path,
embedding_func) -> None:
self.collections = None
self.client = chromadb.PersistentClient(path=client_path)
self.embedding_func = embedding_func
def create_collections(self,collection_name):
self.collections = self.client.create_collection(collection_name,self.embedding_func)
return self.collections
def add_docs(
collections,
embeddings,
metadatas,
ids):
collections.add(
embeddings = embeddings,
metadatas = metadatas,
ids = ids
)
However, putting this inside nodes.py doesn't seems ideal due to I still have other classes (like model class) and I believe mixing everything inside a nodes is an anti-pattern. But if I write a standalone function in nodes.py like below seems redundant.
def create_collections(collections,collections_name):
collections.create_collections(collections_name)
So my question is what are the best way to separate classes and nodes, while avoiding code redundant at the same time?datajoely
07/18/2023, 7:35 AMJuan Luis
07/18/2023, 7:43 AMafter_context_created
or after_catalog_created
https://docs.kedro.org/en/stable/hooks/introduction.html
I see you're using Chroma right? any thoughts on how it compares to, say, Weaviate or others?Jackson
07/18/2023, 9:05 AMdatajoely
07/18/2023, 9:14 AMNok Lam Chan
07/18/2023, 10:32 AMhooks
and maybe add_docs
can be analog to save
method.