Skip to content

Commit 40230ab

Browse files
authored
Add GPT-5 specific safety rules and update agent prompt (#570)
1 parent 6f766af commit 40230ab

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/extension/prompts/node/agent/agentPrompt.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { IPromptVariablesService } from '../../../prompt/node/promptVariablesSer
3333
import { ToolName } from '../../../tools/common/toolNames';
3434
import { CopilotIdentityRules, GPT5CopilotIdentityRule } from '../base/copilotIdentity';
3535
import { IPromptEndpoint, renderPromptElement } from '../base/promptRenderer';
36-
import { SafetyRules } from '../base/safetyRules';
36+
import { Gpt5SafetyRule, SafetyRules } from '../base/safetyRules';
3737
import { Tag } from '../base/tag';
3838
import { TerminalAndTaskStatePromptElement } from '../base/terminalAndTaskState';
3939
import { ChatVariables } from '../panel/chatVariables';
@@ -89,8 +89,17 @@ export class AgentPrompt extends PromptElement<AgentPromptProps> {
8989
const baseAgentInstructions = <>
9090
<SystemMessage>
9191
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
92-
{this.props.endpoint.family.startsWith('gpt-5') ? <GPT5CopilotIdentityRule /> : <CopilotIdentityRules />}
93-
<SafetyRules />
92+
{this.props.endpoint.family.startsWith('gpt-5') ? (
93+
<>
94+
<GPT5CopilotIdentityRule />
95+
<Gpt5SafetyRule />
96+
</>
97+
) : (
98+
<>
99+
<CopilotIdentityRules />
100+
<SafetyRules />
101+
</>
102+
)}
94103
</SystemMessage>
95104
{instructions}
96105
</>;

src/extension/prompts/node/base/safetyRules.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ export class SafetyRules extends PromptElement {
1818
}
1919
}
2020

21+
export class Gpt5SafetyRule extends PromptElement {
22+
render() {
23+
return (
24+
<>
25+
Follow Microsoft content policies.<br />
26+
Avoid content that violates copyrights.<br />
27+
If you are asked to generate content that is harmful, hateful, racist, sexist, lewd, or violent, only respond with "Sorry, I can't assist with that."<br />
28+
</>
29+
);
30+
}
31+
}
32+
2133
export class LegacySafetyRules extends PromptElement {
2234
render() {
2335
return (

0 commit comments

Comments
 (0)