From 36a247c64638506948f18909245fb24c9330fcd6 Mon Sep 17 00:00:00 2001 From: Aldrin Jenson Date: Fri, 15 Sep 2023 22:55:47 +0530 Subject: [PATCH] Make the llm prompt stricter (#505) This is to avoid complex SQL queries --- server/src/handlers/http/llm.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/src/handlers/http/llm.rs b/server/src/handlers/http/llm.rs index 9f7955f9a..d507542a0 100644 --- a/server/src/handlers/http/llm.rs +++ b/server/src/handlers/http/llm.rs @@ -72,10 +72,8 @@ fn build_prompt(stream: &str, prompt: &str, schema_json: &str) -> String { format!( r#"I have a table called {}. It has the columns:\n{} -Based on this, generate valid SQL for the query: "{}" -Generate only 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."#, +Based on this schema, generate valid SQL for the query: "{}" +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."#, stream, schema_json, prompt ) } @@ -84,7 +82,7 @@ fn build_request_body(ai_prompt: String) -> impl serde::Serialize { json!({ "model": "gpt-3.5-turbo", "messages": [{ "role": "user", "content": ai_prompt}], - "temperature": 0.6, + "temperature": 0.7, }) }