@@ -203,10 +203,7 @@ def _parse_genie_mcp_response(
203203 description = content_data .get ("description" , "" )
204204 statement_response = content_data .get ("statement_response" )
205205
206- if (
207- statement_response
208- and statement_response .get ("status" , {}).get ("state" ) == "SUCCEEDED"
209- ):
206+ if statement_response and statement_response .get ("status" , {}).get ("state" ) == "SUCCEEDED" :
210207 result = _parse_query_result (statement_response , truncate_results , return_pandas )
211208 else :
212209 result = content
@@ -316,7 +313,9 @@ def poll_for_result(self, conversation_id, message_id):
316313 except (json .JSONDecodeError , AttributeError , KeyError ):
317314 # End any active span before returning
318315 _end_current_span (client , parent_trace_id , current_span , last_status )
319- return _parse_genie_mcp_response (mcp_result , self .truncate_results , self .return_pandas , conversation_id )
316+ return _parse_genie_mcp_response (
317+ mcp_result , self .truncate_results , self .return_pandas , conversation_id
318+ )
320319
321320 # On status change: end previous span, start new one
322321 if status != last_status :
@@ -350,7 +349,9 @@ def poll_for_result(self, conversation_id, message_id):
350349 if status in TERMINAL_STATES :
351350 # End any active span before returning
352351 _end_current_span (client , parent_trace_id , current_span , last_status )
353- return _parse_genie_mcp_response (mcp_result , self .truncate_results , self .return_pandas , conversation_id )
352+ return _parse_genie_mcp_response (
353+ mcp_result , self .truncate_results , self .return_pandas , conversation_id
354+ )
354355
355356 logging .debug (f"Polling: status={ status } , iteration={ iteration_count } " )
356357 time .sleep (ITERATION_FREQUENCY )
@@ -362,7 +363,6 @@ def poll_for_result(self, conversation_id, message_id):
362363 conversation_id = conversation_id ,
363364 )
364365
365-
366366 @mlflow .trace ()
367367 def ask_question (self , question , conversation_id : Optional [str ] = None ):
368368 if not self ._query_tool_name :
@@ -376,4 +376,6 @@ def ask_question(self, question, conversation_id: Optional[str] = None):
376376 args ["conversation_id" ] = conversation_id
377377
378378 mcp_result = self ._mcp_client .call_tool (self ._query_tool_name , args )
379- return _parse_genie_mcp_response (mcp_result , self .truncate_results , self .return_pandas , conversation_id )
379+ return _parse_genie_mcp_response (
380+ mcp_result , self .truncate_results , self .return_pandas , conversation_id
381+ )
0 commit comments