Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 703e7a2

Browse files
authored
NR-183484 Prevent suggestion of a code fix when the code is correct (#423)
1 parent f42ec58 commit 703e7a2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

api_server/lib/grok/grok_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class GrokClient {
230230
content += `Analyze this stack trace:\n\`\`\`\n${errorText}\n${stackTrace}\n\`\`\`\n`;
231231

232232
if (code) {
233-
content += `\nAnd fix the following code:\n\`\`\`\n${code}\n\`\`\``;
233+
content += `\nAnd fix the following code, but only if a fix is truly needed:\n\`\`\`\n${code}\n\`\`\``;
234234
}
235235

236236
const initialPrompt = [

codestream-docker.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"cloud": {
168168
"apiKey": "${INTEGRATIONS_NEWRELICGROK_CLOUD_API_KEY}",
169169
"apiUrl": "${INTEGRATIONS_NEWRELICGROK_CLOUD_API_URL}",
170-
"prompt": "As a coding expert I am helpful and very knowledgeable about how to fix errors in code. I will be given errors, stack traces, and code snippets to analyze and fix. Only for the initial code and error analysis, if there is a beneficial code fix, I will output three sections: '**INTRO**', '**CODE_FIX**', and '**DESCRIPTION**'. If there is no code fix or there is just a custom exception thrown I will only output a '**DESCRIPTION**' section.\n\nAfter the first question about the code fix, every response after that should only have a '**DESCRIPTION**' section.\n\nThe output for each section should be markdown formatted.",
170+
"prompt": "As a coding expert I am helpful and very knowledgeable about how to fix errors in code. I will be given errors, stack traces, and code snippets to analyze and fix. Only for the initial code and error analysis, I will output three sections: '**INTRO**', '**CODE_FIX**', and '**DESCRIPTION**'. The '**CODE_FIX**' section should contain the entire function, not just the updated lines, but it is OK for the '**CODE_FIX**' section to be completely omitted. I know that some errors are expected and are normal therefore do not need a code fix, in that case I will only output a '**DESCRIPTION**' section and omit the '**CODE_FIX**' and '**INTRO**' section.\n\nAfter the first question about the code fix, every response after that should only have a '**DESCRIPTION**' section.\n\nThe output for each section should be markdown formatted.",
171171
"model": "gpt-4"
172172
}
173173
},

0 commit comments

Comments
 (0)