File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 2828 import chromadb .config
2929 from chromadb .api .types import ID , OneOrMany , Where , WhereDocument
3030
31+
3132logger = logging .getLogger ()
3233DEFAULT_K = 4 # Number of Documents to return.
3334
@@ -80,6 +81,7 @@ def __init__(
8081 try :
8182 import chromadb
8283 import chromadb .config
84+ from chromadb .utils import embedding_functions
8385 except ImportError :
8486 raise ImportError (
8587 "Could not import chromadb python package. "
@@ -122,10 +124,12 @@ def __init__(
122124 _client_settings .persist_directory or persist_directory
123125 )
124126
125- self ._embedding_function = embedding_function
127+ self ._embedding_function = (
128+ embedding_function or embedding_functions .DefaultEmbeddingFunction ()
129+ )
126130 self ._collection = self ._client .get_or_create_collection (
127131 name = collection_name ,
128- embedding_function = None ,
132+ embedding_function = self . _embedding_function ,
129133 metadata = collection_metadata ,
130134 )
131135 self .override_relevance_score_fn = relevance_score_fn
You can’t perform that action at this time.
0 commit comments