From 56930f76cc829845006d5c7deb17b681e722c8ea Mon Sep 17 00:00:00 2001 From: Rui Azevedo Date: Thu, 11 Jul 2024 10:39:55 +0100 Subject: [PATCH] Change the "write-tests" task prompt to enforce the generated code to be inside code fences, to ensure we can extract the code from the LLMs response Part of #257 --- model/llm/llm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/llm/llm.go b/model/llm/llm.go index ae3f7961..0370d382 100644 --- a/model/llm/llm.go +++ b/model/llm/llm.go @@ -77,7 +77,7 @@ type llmSourceFilePromptContext struct { var llmGenerateTestForFilePromptTemplate = template.Must(template.New("model-llm-generate-test-for-file-prompt").Parse(bytesutil.StringTrimIndentations(` Given the following {{ .Language.Name }} code file "{{ .FilePath }}" with package "{{ .ImportPath }}", provide a test file for this code{{ with $testFramework := .Language.TestFramework }} with {{ $testFramework }} as a test framework{{ end }}. The tests should produce 100 percent code coverage and must compile. - The response must contain only the test code and nothing else. + The response must contain only the test code in a fenced code block and nothing else. ` + "```" + `{{ .Language.ID }} {{ .Code }}