Skip to content

Commit

Permalink
fix: ensure that connection to weaviate is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Sep 15, 2023
1 parent 579b0fd commit 7eb56c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions streamlit_examples/utils/weaviate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,7 +21,6 @@ def connect_weaviate():
},
)

client.is_ready()
return client


Expand Down

0 comments on commit 7eb56c0

Please sign in to comment.