@@ -13,6 +13,8 @@ def construct_sql_payload(self, user_question, db_schema):
13
13
prompt = (
14
14
"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n \n "
15
15
f"Generate a SQL query only to answer this question without explanation: `{ user_question } `\n "
16
+ "considering values like true,TRUE,yes,Yes,YES in a case-insensitive manner.\n "
17
+ "considering values like false,FALSE,no,No,NO in a case-insensitive manner.\n "
16
18
"DDL statements:\n "
17
19
f"{ db_schema } <|start_header_id|>assistant<|end_header_id|>\n \n "
18
20
)
@@ -22,7 +24,21 @@ def construct_sql_payload(self, user_question, db_schema):
22
24
"stream" : False ,
23
25
"temperature" : 0
24
26
}
27
+ def construct_generic_payload (self , user_question ):
28
+ prompt = user_question
29
+ return {
30
+ "model" : self .model_name ,
31
+ "messages" : [{"role" : "user" , "content" : prompt }],
32
+ "temperature" : 0.7 ,
33
+ "max_new_tokens" : 4096 ,
34
+ "max_length" : 4096 ,
35
+ "top_p" : 0.9 ,
36
+ "repetition_penalty" : 1.1 ,
37
+ "stream" : False ,
38
+ "max_tokens" : 1024
25
39
40
+ }
41
+
26
42
def parse_response (self , response ):
27
43
logger .info (f"Parsing response for Ollama { response } " )
28
44
return response .get ('message' , {}).get ('content' , '' ).strip ()
0 commit comments