MCPcopy
hub / github.com/langroid/langroid / set_collection

Method set_collection

langroid/vector_store/postgres.py:194–207  ·  view source on GitHub ↗
(self, collection_name: str, replace: bool = False)

Source from the content-addressed store, hash-verified

192 connection.execute(statement)
193
194 def set_collection(self, collection_name: str, replace: bool = False) -> None:
195 inspector = inspect(self.engine)
196 table_exists = collection_name in inspector.get_table_names()
197
198 if (
199 collection_name == self.config.collection_name
200 and table_exists
201 and not replace
202 ):
203 return
204 else:
205 self.config.collection_name = collection_name
206 self.config.replace_collection = replace
207 self._setup_table()
208
209 def list_collections(self, empty: bool = True) -> List[str]:
210 inspector = inspect(self.engine)

Callers 1

create_collectionMethod · 0.95

Calls 2

_setup_tableMethod · 0.95
get_table_namesMethod · 0.80

Tested by

no test coverage detected