Remove interactive prompts when users attempt a very large request. This is to improve agentic usage.
|
# If the number of results is small enough and download is off, it's okay to show as df |
|
if num_results < 1000000 and not download: |
|
return _batch_to_df(core, params, num_results) |
|
|
|
# If it's too big, warn the user and ask if they want to proceed. |
|
else: |
|
print( |
|
"Your request might exceed the available memory. We suggest setting 'download=True' and reading the file in batches" |
|
) |
|
prompt = input( |
|
"Do you wish to proceed anyway? press ('y' or enter to proceed) / type('n' or 'exit' to cancel)" |
|
) |
|
match prompt: |
|
case "n" | "exit": |
|
print("Exiting gracefully") |
|
exit() |
|
case "y" | "": |
|
print("Fetching data...") |
|
return _batch_to_df(core, params, num_results) |
Remove interactive prompts when users attempt a very large request. This is to improve agentic usage.
impc-api/impc_api/batch_solr_request.py
Lines 104 to 122 in 29349a9