Fix key errors in weaviate hybrid retriever init (#7988)

This commit is contained in:
Nuno Campos 2023-07-20 14:22:18 +01:00 committed by GitHub
parent df84e1bb64
commit 8edb1db9dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,12 +48,12 @@ class WeaviateHybridSearchRetriever(BaseRetriever):
raise ValueError(
f"client should be an instance of weaviate.Client, got {type(client)}"
)
if values["attributes"] is None:
if values.get("attributes") is None:
values["attributes"] = []
cast(List, values["attributes"]).append(values["text_key"])
if values["create_schema_if_missing"]:
if values.get("create_schema_if_missing", True):
class_obj = {
"class": values["index_name"],
"properties": [{"name": values["text_key"], "dataType": ["text"]}],