File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
libs/weaviate/langchain_weaviate Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ def __init__(
91
91
index_name : Optional [str ],
92
92
text_key : str ,
93
93
embedding : Optional [Embeddings ] = None ,
94
+ schema : Optional [dict ] = None ,
94
95
attributes : Optional [List [str ]] = None ,
95
96
relevance_score_fn : Optional [
96
97
Callable [[float ], float ]
@@ -113,12 +114,15 @@ def __init__(
113
114
if attributes is not None :
114
115
self ._query_attrs .extend (attributes )
115
116
116
- schema = _default_schema (self ._index_name )
117
- schema ["MultiTenancyConfig" ] = {"enabled" : use_multi_tenancy }
117
+ if not schema :
118
+ self .schema = _default_schema (self ._index_name )
119
+ self .schema ["MultiTenancyConfig" ] = {"enabled" : use_multi_tenancy }
120
+ else :
121
+ self .schema = schema
118
122
119
123
# check whether the index already exists
120
124
if not client .collections .exists (self ._index_name ):
121
- client .collections .create_from_dict (schema )
125
+ client .collections .create_from_dict (self . schema )
122
126
123
127
# store collection for convenience
124
128
# this does not actually send a request to weaviate
You can’t perform that action at this time.
0 commit comments