Skip to content
This repository was archived by the owner on Jun 2, 2026. It is now read-only.

Commit 6edc7c6

Browse files
Fix pending UI blocking calls
2 parents da6c08b + 74a4b70 commit 6edc7c6

5 files changed

Lines changed: 192 additions & 93 deletions

File tree

app.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Description = "QnA with tabular data using NLQ"
55
LongDescription = "about.md"
66
InstanceLifecycle = "MANAGED"
77
Tags = ["DATA_SCIENCE", "MACHINE_LEARNING", "NLP", "GENERATIVE_AI"]
8-
Version = "0.2.3"
8+
Version = "0.2.4"
99

1010
[Runtime]
1111
MemoryLimit = "64Gi"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sql-sidekick"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
license = "Apache-2.0 license"
55
description = "An AI assistant for SQL generation"
66
authors = [

sidekick/prompter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
execute_query_pd, extract_table_names,
2525
generate_suggestions, save_query, setup_dir)
2626

27-
__version__ = "0.2.3"
27+
__version__ = "0.2.4"
2828

2929
# Load the config file and initialize required paths
3030
app_base_path = (Path(__file__).parent / "../").resolve()

sidekick/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def check_vulnerability(input_query: str):
629629

630630

631631
def generate_suggestions(remote_url, client_key:str, column_names: list, n_qs: int=10):
632-
results = []
632+
text_completion = []
633633

634634
column_info = ','.join(column_names)
635635
_system_prompt = f"Act as a data analyst, based on below data schema help answer the question"
@@ -640,12 +640,13 @@ def generate_suggestions(remote_url, client_key:str, column_names: list, n_qs: i
640640
if "h2ogpt-" in recommender_model:
641641
try:
642642
client = H2OGPTE(address=remote_url, api_key=client_key)
643-
text_completion = client.answer_question(
643+
response = client.answer_question(
644644
system_prompt=_system_prompt,
645645
text_context_list=[],
646646
question=_user_prompt,
647647
llm=recommender_model
648648
)
649+
text_completion = response.content.split("\n")[2:]
649650
except Exception as e:
650651
remote_url = os.getenv("H2OGPT_BASE_URL", None)
651652
client_key = os.getenv("H2OGPT_BASE_API_TOKEN", None)
@@ -660,7 +661,7 @@ def generate_suggestions(remote_url, client_key:str, column_names: list, n_qs: i
660661
max_tokens=512,
661662
temperature=0.5,
662663
seed=42)
663-
text_completion = completion.choices[0].message
664+
text_completion = completion.choices[0].message.content.split("\n")[2:]
664665
elif 'gpt-3.5' in recommender_model.lower() or 'gpt-4' in recommender_model.lower():
665666
# Check if the API key is set, else inform user
666667
logger.info(f"Using OpenAI model: {recommender_model}")
@@ -674,9 +675,8 @@ def generate_suggestions(remote_url, client_key:str, column_names: list, n_qs: i
674675
seed=42,
675676
temperature=0.7
676677
)
677-
text_completion = completion.choices[0].message
678+
text_completion = completion.choices[0].message.content.split("\n")
678679
else:
679680
raise Exception("Model url or key is missing.")
680-
_res = text_completion.content.split("\n")[2:]
681-
results = "\n".join(_res)
681+
results = "\n".join(text_completion)
682682
return results

0 commit comments

Comments
 (0)