Gregor Betz commited on
Commit
4510b5f
1 Parent(s): e64f722

health check

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -146,6 +146,15 @@ async def bot(
146
  # use guide always and exclusively at first turn
147
  if len(history_langchain_format) <= 1:
148
 
 
 
 
 
 
 
 
 
 
149
  message = history[-1][0]
150
 
151
  try:
@@ -204,16 +213,6 @@ with gr.Blocks() as demo:
204
  guide_config = RecursiveBalancingGuideConfig(**guide_kwargs)
205
  guide = RecursiveBalancingGuide(tourist_llm=client_llm, config=guide_config)
206
 
207
- # health check
208
- # run async guide.health_check() as coroutine
209
- health_check = asyncio.run(guide.health_check())
210
-
211
- if health_check.get("status", None) != "ok":
212
- health_msg = " | ".join([f"{k}: {v}" for k, v in health_check.items()])
213
- logging.error(f"Guide health check failed: {health_msg}")
214
- gr.Error(f"LLM availability / health check failed: {health_msg}")
215
- logging.info(f"Health check: {health_check}")
216
-
217
  with gr.Tab(label="Chatbot", visible=False) as chatbot_tab:
218
 
219
  # chatbot
 
146
  # use guide always and exclusively at first turn
147
  if len(history_langchain_format) <= 1:
148
 
149
+ # health check
150
+ health_check = await guide.health_check()
151
+
152
+ if health_check.get("status", None) != "ok":
153
+ health_msg = " | ".join([f"{k}: {v}" for k, v in health_check.items()])
154
+ logging.error(f"Guide health check failed: {health_msg}")
155
+ gr.Error(f"LLM availability / health check failed: {health_msg}")
156
+ logging.info(f"Health check: {health_check}")
157
+
158
  message = history[-1][0]
159
 
160
  try:
 
213
  guide_config = RecursiveBalancingGuideConfig(**guide_kwargs)
214
  guide = RecursiveBalancingGuide(tourist_llm=client_llm, config=guide_config)
215
 
 
 
 
 
 
 
 
 
 
 
216
  with gr.Tab(label="Chatbot", visible=False) as chatbot_tab:
217
 
218
  # chatbot