ns-devel
commited on
Commit
·
8b9a027
1
Parent(s):
6fc46a1
Added print logs
Browse files- core/models.py +1 -0
- core/text2sql/handler.py +1 -0
- core/views.py +2 -2
core/models.py
CHANGED
@@ -43,6 +43,7 @@ class MutualFund(BaseModel):
|
|
43 |
try:
|
44 |
return cls.execute_raw_sql_query(query)
|
45 |
except Exception as e:
|
|
|
46 |
return []
|
47 |
|
48 |
class Stock(BaseModel):
|
|
|
43 |
try:
|
44 |
return cls.execute_raw_sql_query(query)
|
45 |
except Exception as e:
|
46 |
+
print("Error: ", repr(e))
|
47 |
return []
|
48 |
|
49 |
class Stock(BaseModel):
|
core/text2sql/handler.py
CHANGED
@@ -21,6 +21,7 @@ class QueryDataHandler:
|
|
21 |
"""
|
22 |
# Use Text2SQL ML model to generate a PostgreSQL query
|
23 |
sql_query = self.text2sql_model.generate_query(prompt)
|
|
|
24 |
logger.info(f"SQL Query: {sql_query}")
|
25 |
# Use Django models to fetch data
|
26 |
return sql_query, self.mutual_fund.execute_query(sql_query)
|
|
|
21 |
"""
|
22 |
# Use Text2SQL ML model to generate a PostgreSQL query
|
23 |
sql_query = self.text2sql_model.generate_query(prompt)
|
24 |
+
print("SQL Query: ", sql_query)
|
25 |
logger.info(f"SQL Query: {sql_query}")
|
26 |
# Use Django models to fetch data
|
27 |
return sql_query, self.mutual_fund.execute_query(sql_query)
|
core/views.py
CHANGED
@@ -23,8 +23,8 @@ def get_mf_data(request):
|
|
23 |
Retrieves mutual fund data based on user query.
|
24 |
"""
|
25 |
query = request.GET.get("query", "")
|
26 |
-
|
27 |
prompt = get_prompt(query)
|
28 |
-
|
29 |
query, data = QueryDataHandler().get_data_from_query(prompt)
|
30 |
return JsonResponse({"status": "success", "query": query, "data": data}, status=200)
|
|
|
23 |
Retrieves mutual fund data based on user query.
|
24 |
"""
|
25 |
query = request.GET.get("query", "")
|
26 |
+
print("Query: ", query)
|
27 |
prompt = get_prompt(query)
|
28 |
+
print("Prompt: ", prompt)
|
29 |
query, data = QueryDataHandler().get_data_from_query(prompt)
|
30 |
return JsonResponse({"status": "success", "query": query, "data": data}, status=200)
|