Skip to content

Commit 91f6327

Browse files
committed
better prompt
1 parent fcdc8dd commit 91f6327

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

src/main/scala/functorcoder/llm/llmMain.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ object llmMain {
3030
val openAiRequest = openaiReq
3131
.OpenAiRequest(
3232
List(
33-
openaiReq.Message(roles.user, inputPrompt.generatePrompt),
34-
openaiReq.Message(roles.system, inputPrompt.getAssistantMessage)
33+
openaiReq.Message(roles.system, inputPrompt.getSysMessage),
34+
openaiReq.Message(roles.user, inputPrompt.generatePrompt)
3535
),
3636
editorCfg.model,
3737
max_tokens = Some(editorCfg.maxTokens)

src/main/scala/functorcoder/llm/llmPrompt.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object llmPrompt {
2828
// trait will have undefined value, so we use abstract class
2929
sealed abstract class Prompt(val assistantMsg: String) {
3030
def generatePrompt: String
31-
def getAssistantMessage: String = assistantMsg
31+
def getSysMessage: String = assistantMsg
3232
}
3333

3434
/** code completion prompt
@@ -51,7 +51,7 @@ object llmPrompt {
5151
case class Completion(
5252
codeWithHole: String, // code with a hole to fill like {{FILL_HERE}}
5353
// taskRequirement: String, // like "Fill the {{FILL_HERE}} hole."
54-
assistantMessage: String = promptText.promptComp1
54+
assistantMessage: String = promptText.promptComp3
5555
) extends Prompt(assistantMessage) {
5656
def generatePrompt = {
5757

@@ -122,6 +122,8 @@ object llmPrompt {
122122
"you replace this hole with your reply." +
123123
"only return the string for the hole with indentation, without any quotes"
124124

125+
val promptComp3 = s"Fill in the missing text specified by $hole. Only return the string which replace the hole. " +
126+
"Don't wrap it with backticks or any other tags"
125127
}
126128

127129
def generateDocs(language: String) = {

src/main/scala/functorcoder/llm/wk.worksheet.sc

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)