From 7eb56c0cb8e94b2f7cb503cec45d955a67fb3cc4 Mon Sep 17 00:00:00 2001 From: Marcus Schiesser Date: Fri, 15 Sep 2023 17:41:51 +0700 Subject: [PATCH] fix: ensure that connection to weaviate is ready --- streamlit_examples/utils/weaviate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/streamlit_examples/utils/weaviate.py b/streamlit_examples/utils/weaviate.py index e8e1534..56ec2d1 100644 --- a/streamlit_examples/utils/weaviate.py +++ b/streamlit_examples/utils/weaviate.py @@ -3,7 +3,10 @@ from streamlit_examples.utils.cohere import cohere_api_key -@st.cache_resource(show_spinner="Connecting to Weaviate...") +@st.cache_resource( + show_spinner="Connecting to Weaviate...", + validate=lambda client: client.is_ready(), +) def connect_weaviate(): # Connect to the Weaviate demo database containing 10M wikipedia vectors # This uses a public READ-ONLY Weaviate API key @@ -18,7 +21,6 @@ def connect_weaviate(): }, ) - client.is_ready() return client