MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / runQuery

Method runQuery

AskAgent/python/core/baseHandler.py:321–350  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

319
320
321 async def runQuery(self):
322 logger.info(f"Starting query execution for conversation_id: {self.conversation_id}")
323 try:
324 # Send begin-nlweb-response message at the start
325 await self.message_sender.send_begin_response()
326
327 await self.prepare()
328 if (self.query_done):
329 return [msg.to_dict() for msg in self.messages]
330 if (not self.fastTrackWorked):
331 await self.route_query_based_on_tools()
332
333 # Check if query is done regardless of whether FastTrack worked
334 if (self.query_done):
335 return [msg.to_dict() for msg in self.messages]
336
337 await post_ranking.PostRanking(self).do()
338
339 # Send end-nlweb-response message at the end
340 await self.message_sender.send_end_response()
341
342 # Return only messages (no more legacy return_value)
343 return [msg.to_dict() for msg in self.messages]
344 except Exception:
345 traceback.print_exc()
346
347 # Send end-nlweb-response even on error
348 await self.message_sender.send_end_response(error=True)
349
350 raise
351
352 async def prepare(self):
353 tasks = []

Callers 7

single_turnFunction · 0.95
run_multiturn_benchmarkFunction · 0.95
run_single_testMethod · 0.95
handle_queryMethod · 0.95
handle_streaming_askFunction · 0.95
handle_regular_askFunction · 0.95

Calls 7

prepareMethod · 0.95
send_begin_responseMethod · 0.80
send_end_responseMethod · 0.80
infoMethod · 0.45
to_dictMethod · 0.45
doMethod · 0.45

Tested by 1

run_single_testMethod · 0.76