Skip to content

Commit 36a247c

Browse files
authored
Make the llm prompt stricter (#505)
This is to avoid complex SQL queries
1 parent dcc83e1 commit 36a247c

File tree

1 file changed

+3
-5
lines changed
  • server/src/handlers/http

1 file changed

+3
-5
lines changed

server/src/handlers/http/llm.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ fn build_prompt(stream: &str, prompt: &str, schema_json: &str) -> String {
7272
format!(
7373
r#"I have a table called {}.
7474
It has the columns:\n{}
75-
Based on this, generate valid SQL for the query: "{}"
76-
Generate only SQL as output. Also add comments in SQL syntax to explain your actions.
77-
Don't output anything else.
78-
If it is not possible to generate valid SQL, output an SQL comment saying so."#,
75+
Based on this schema, generate valid SQL for the query: "{}"
76+
Generate only simple SQL as output. Also add comments in SQL syntax to explain your actions. Don't output anything else. If it is not possible to generate valid SQL, output an SQL comment saying so."#,
7977
stream, schema_json, prompt
8078
)
8179
}
@@ -84,7 +82,7 @@ fn build_request_body(ai_prompt: String) -> impl serde::Serialize {
8482
json!({
8583
"model": "gpt-3.5-turbo",
8684
"messages": [{ "role": "user", "content": ai_prompt}],
87-
"temperature": 0.6,
85+
"temperature": 0.7,
8886
})
8987
}
9088

0 commit comments

Comments
 (0)