44"""CLI implementation of the query subcommand."""
55
66import asyncio
7- import logging
87import sys
98from pathlib import Path
109from typing import TYPE_CHECKING , Any
1918if TYPE_CHECKING :
2019 import pandas as pd
2120
22- # Initialize standard logger
23- logger = logging .getLogger (__name__ )
21+ # ruff: noqa: T201
2422
2523
2624def run_global_search (
@@ -61,10 +59,6 @@ def run_global_search(
6159 final_community_reports_list = dataframe_dict ["community_reports" ]
6260 index_names = dataframe_dict ["index_names" ]
6361
64- logger .info (
65- "Running multi-index global search on indexes: %s" ,
66- dataframe_dict ["index_names" ],
67- )
6862 response , context_data = asyncio .run (
6963 api .multi_index_global_search (
7064 config = config ,
@@ -80,11 +74,7 @@ def run_global_search(
8074 verbose = verbose ,
8175 )
8276 )
83- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
84- logger .info ("Query Response:\n %s" , response )
85-
86- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
87- # External users should use the API directly to get the response and context data.
77+ print (response )
8878 return response , context_data
8979
9080 # Otherwise, call the Single-Index Global Search API
@@ -118,9 +108,9 @@ def on_context(context: Any) -> None:
118108 verbose = verbose ,
119109 ):
120110 full_response += stream_chunk
121- print (stream_chunk , end = "" ) # noqa: T201
122- sys .stdout .flush () # flush output buffer to display text immediately
123- print () # noqa: T201
111+ print (stream_chunk , end = "" )
112+ sys .stdout .flush ()
113+ print ()
124114 return full_response , context_data
125115
126116 return asyncio .run (run_streaming_search ())
@@ -138,11 +128,8 @@ def on_context(context: Any) -> None:
138128 verbose = verbose ,
139129 )
140130 )
141- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
142- logger .info ("Global Search Response:\n %s" , response )
131+ print (response )
143132
144- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
145- # External users should use the API directly to get the response and context data.
146133 return response , context_data
147134
148135
@@ -188,11 +175,6 @@ def run_local_search(
188175 final_relationships_list = dataframe_dict ["relationships" ]
189176 index_names = dataframe_dict ["index_names" ]
190177
191- logger .info (
192- "Running multi-index local search on indexes: %s" ,
193- dataframe_dict ["index_names" ],
194- )
195-
196178 # If any covariates tables are missing from any index, set the covariates list to None
197179 if len (dataframe_dict ["covariates" ]) != dataframe_dict ["num_indexes" ]:
198180 final_covariates_list = None
@@ -216,11 +198,8 @@ def run_local_search(
216198 verbose = verbose ,
217199 )
218200 )
219- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
220- logger .info ("Local Search Response:\n %s" , response )
201+ print (response )
221202
222- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
223- # External users should use the API directly to get the response and context data.
224203 return response , context_data
225204
226205 # Otherwise, call the Single-Index Local Search API
@@ -259,9 +238,9 @@ def on_context(context: Any) -> None:
259238 verbose = verbose ,
260239 ):
261240 full_response += stream_chunk
262- print (stream_chunk , end = "" ) # noqa: T201
263- sys .stdout .flush () # flush output buffer to display text immediately
264- print () # noqa: T201
241+ print (stream_chunk , end = "" )
242+ sys .stdout .flush ()
243+ print ()
265244 return full_response , context_data
266245
267246 return asyncio .run (run_streaming_search ())
@@ -281,11 +260,8 @@ def on_context(context: Any) -> None:
281260 verbose = verbose ,
282261 )
283262 )
284- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
285- logger .info ("Local Search Response:\n %s" , response )
263+ print (response )
286264
287- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
288- # External users should use the API directly to get the response and context data.
289265 return response , context_data
290266
291267
@@ -329,11 +305,6 @@ def run_drift_search(
329305 final_relationships_list = dataframe_dict ["relationships" ]
330306 index_names = dataframe_dict ["index_names" ]
331307
332- logger .info (
333- "Running multi-index drift search on indexes: %s" ,
334- dataframe_dict ["index_names" ],
335- )
336-
337308 response , context_data = asyncio .run (
338309 api .multi_index_drift_search (
339310 config = config ,
@@ -350,11 +321,8 @@ def run_drift_search(
350321 verbose = verbose ,
351322 )
352323 )
353- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
354- logger .info ("DRIFT Search Response:\n %s" , response )
324+ print (response )
355325
356- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
357- # External users should use the API directly to get the response and context data.
358326 return response , context_data
359327
360328 # Otherwise, call the Single-Index Drift Search API
@@ -391,9 +359,9 @@ def on_context(context: Any) -> None:
391359 verbose = verbose ,
392360 ):
393361 full_response += stream_chunk
394- print (stream_chunk , end = "" ) # noqa: T201
395- sys .stdout .flush () # flush output buffer to display text immediately
396- print () # noqa: T201
362+ print (stream_chunk , end = "" )
363+ sys .stdout .flush ()
364+ print ()
397365 return full_response , context_data
398366
399367 return asyncio .run (run_streaming_search ())
@@ -413,11 +381,8 @@ def on_context(context: Any) -> None:
413381 verbose = verbose ,
414382 )
415383 )
416- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
417- logger .info ("DRIFT Search Response:\n %s" , response )
384+ print (response )
418385
419- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
420- # External users should use the API directly to get the response and context data.
421386 return response , context_data
422387
423388
@@ -451,11 +416,6 @@ def run_basic_search(
451416 final_text_units_list = dataframe_dict ["text_units" ]
452417 index_names = dataframe_dict ["index_names" ]
453418
454- logger .info (
455- "Running multi-index basic search on indexes: %s" ,
456- dataframe_dict ["index_names" ],
457- )
458-
459419 response , context_data = asyncio .run (
460420 api .multi_index_basic_search (
461421 config = config ,
@@ -466,11 +426,8 @@ def run_basic_search(
466426 verbose = verbose ,
467427 )
468428 )
469- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
470- logger .info ("Basic Search Response:\n %s" , response )
429+ print (response )
471430
472- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
473- # External users should use the API directly to get the response and context data.
474431 return response , context_data
475432
476433 # Otherwise, call the Single-Index Basic Search API
@@ -497,9 +454,9 @@ def on_context(context: Any) -> None:
497454 verbose = verbose ,
498455 ):
499456 full_response += stream_chunk
500- print (stream_chunk , end = "" ) # noqa: T201
501- sys .stdout .flush () # flush output buffer to display text immediately
502- print () # noqa: T201
457+ print (stream_chunk , end = "" )
458+ sys .stdout .flush ()
459+ print ()
503460 return full_response , context_data
504461
505462 return asyncio .run (run_streaming_search ())
@@ -512,11 +469,8 @@ def on_context(context: Any) -> None:
512469 verbose = verbose ,
513470 )
514471 )
515- # log the full response at INFO level for user visibility but at DEBUG level in the API layer
516- logger .info ("Basic Search Response:\n %s" , response )
472+ print (response )
517473
518- # NOTE: we return the response and context data here purely as a complete demonstration of the API.
519- # External users should use the API directly to get the response and context data.
520474 return response , context_data
521475
522476
0 commit comments