41
41
os .environ ["TOKENIZERS_PARALLELISM" ] = "False"
42
42
os .environ ["H2O_BASE_MODEL_URL" ] = h2ogpt_base_model_url
43
43
os .environ ["H2O_BASE_MODEL_API_KEY" ] = h2ogpt_base_model_key
44
+ os .environ ["RECOMMENDATION_MODEL_REMOTE_URL" ] = h2o_remote_url
45
+ os .environ ["RECOMMENDATION_MODEL_API_KEY" ] = h2o_key
44
46
45
47
def color (fore = "" , back = "" , text = None ):
46
48
return f"{ fore } { back } { text } { Style .RESET_ALL } "
@@ -650,12 +652,12 @@ def ask(
650
652
attempt = 0
651
653
error_condition = lambda e : ('OperationalError' .lower () in e .lower () or 'OperationError' .lower () in e .lower () or 'Syntax error' .lower () in e .lower ()) if e else False
652
654
if self_correction and error_condition (err ):
653
- logger .info ("Attempting to auto-correct the query..." )
655
+ logger .info ("Attempting to auto-correct the query during runtime ..." )
654
656
while attempt != 3 and error_condition (err ):
655
657
try :
656
658
logger .debug (f"Attempt: { attempt + 1 } " )
657
659
_tmp = err .split ("\n " )
658
- _err = _tmp [0 ].split ("Error occurred :" )[1 ] if len (_tmp ) > 0 else None
660
+ _err = _tmp [0 ].split ("Error occurred:" )[1 ] if len (_tmp ) > 0 else None
659
661
env_url = os .environ ["RECOMMENDATION_MODEL_REMOTE_URL" ]
660
662
env_key = os .environ ["RECOMMENDATION_MODEL_API_KEY" ]
661
663
corr_sql = sql_g .self_correction (input_prompt = _val , error_msg = _err , remote_url = env_url , client_key = env_key )
@@ -667,7 +669,7 @@ def ask(
667
669
logger .error (f"Something went wrong:\n { e } " )
668
670
attempt += 1
669
671
if m :
670
- _t = "\n Warning: \n " .join ([str (q_res ), m ])
672
+ _t = "\n \n **Warning:** \n " .join ([str (q_res ), m ])
671
673
q_res = _t
672
674
elif option == "pandas" :
673
675
tables = extract_table_names (_val )
@@ -697,7 +699,7 @@ def ask(
697
699
click .echo ("Error in executing the query. Validate generated SQL and try again." )
698
700
click .echo ("No result to display." )
699
701
700
- results .append ("**Result:** \n " )
702
+ results .append ("**Result:**\n " )
701
703
if q_res :
702
704
# Check shape of the final result to avoid blowing up memory
703
705
# Logging a quick preview of the result
0 commit comments