Skip to content

Commit

Permalink
Change the "code-repair" task prompt to enforce the generated code to…
Browse files Browse the repository at this point in the history
… be inside code fences, to ensure we can extract the code from the LLMs response

Closes #257
  • Loading branch information
ruiAzevedo19 committed Jul 11, 2024
1 parent 56930f7 commit b8a3bb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model/llm/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type llmCodeRepairSourceFilePromptContext struct {
// llmCodeRepairSourceFilePromptTemplate is the template for generating an LLM code repair prompt.
var llmCodeRepairSourceFilePromptTemplate = template.Must(template.New("model-llm-code-repair-source-file-prompt").Parse(bytesutil.StringTrimIndentations(`
Given the following {{ .Language.Name }} code file "{{ .FilePath }}" with package "{{ .ImportPath }}" and a list of compilation errors, modify the code such that the errors are resolved.
The response must contain only the source code and nothing else.
The response must contain only the source code in a fenced code block and nothing else.
` + "```" + `{{ .Language.ID }}
{{ .Code }}
Expand Down
2 changes: 1 addition & 1 deletion model/llm/llm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func TestLLMCodeRepairSourceFilePrompt(t *testing.T) {

ExpectedMessage: bytesutil.StringTrimIndentations(`
Given the following Go code file "/path/to/foobar.go" with package "foobar" and a list of compilation errors, modify the code such that the errors are resolved.
The response must contain only the source code and nothing else.
The response must contain only the source code in a fenced code block and nothing else.
` + "```" + `golang
package foobar
Expand Down

0 comments on commit b8a3bb5

Please sign in to comment.