Add exception handling for missing 'content' field in search_with_vector_store method
This commit is contained in:
parent
4e3690cedc
commit
3315308331
1 changed files with 9 additions and 1 deletions
|
|
@ -137,4 +137,12 @@ class AstraDBSearchComponent(LCVectorStoreComponent):
|
||||||
metadata_indexing_exclude=metadata_indexing_exclude,
|
metadata_indexing_exclude=metadata_indexing_exclude,
|
||||||
collection_indexing_policy=collection_indexing_policy,
|
collection_indexing_policy=collection_indexing_policy,
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
return self.search_with_vector_store(input_value, search_type, vector_store, k=number_of_results)
|
return self.search_with_vector_store(input_value, search_type, vector_store, k=number_of_results)
|
||||||
|
except KeyError as e:
|
||||||
|
if "content" in str(e):
|
||||||
|
raise ValueError(
|
||||||
|
"You should ingest data through Langflow (or LangChain) to query it in Langflow. Your collection does not contain a field name 'content'."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue