From d2ef5d6167d266c436420bfcae1aba968a9f4d52 Mon Sep 17 00:00:00 2001 From: Anton Troynikov Date: Mon, 20 Feb 2023 20:59:34 -0800 Subject: [PATCH] Default Chroma collection name (#1198) For persistence, it's convenient to have a default collection name which gets used everywhere. --- langchain/vectorstores/chroma.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py index 98379b0d0c..2cae7f72ff 100644 --- a/langchain/vectorstores/chroma.py +++ b/langchain/vectorstores/chroma.py @@ -27,9 +27,11 @@ class Chroma(VectorStore): vectorstore = Chroma("langchain_store", embeddings.embed_query) """ + _LANGCHAIN_DEFAULT_COLLECTION_NAME = "langchain" + def __init__( self, - collection_name: str, + collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME, embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, ) -> None: @@ -155,7 +157,7 @@ class Chroma(VectorStore): embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, - collection_name: str = "langchain", + collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME, persist_directory: Optional[str] = None, **kwargs: Any, ) -> Chroma: @@ -189,7 +191,7 @@ class Chroma(VectorStore): documents: List[Document], embedding: Optional[Embeddings] = None, ids: Optional[List[str]] = None, - collection_name: str = "langchain", + collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME, persist_directory: Optional[str] = None, **kwargs: Any, ) -> Chroma: