Skip to content

Commit 41ccf83

Browse files
authored
update model family checks (#556)
* fix: update model family checks * fix: simplify model family checks
1 parent 4f90787 commit 41ccf83

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface DefaultAgentPromptProps extends BasePromptElementProps {
6161
export class DefaultAgentPrompt extends PromptElement<DefaultAgentPromptProps> {
6262
async render(state: void, sizing: PromptSizing) {
6363
const tools = detectToolCapabilities(this.props.availableTools);
64-
const isGpt5 = this.props.modelFamily === 'gpt-5';
64+
const isGpt5 = this.props.modelFamily?.startsWith('gpt-5') === true;
6565

6666
return <InstructionMessage>
6767
<Tag name='instructions'>
@@ -213,7 +213,7 @@ export class DefaultAgentPrompt extends PromptElement<DefaultAgentPromptProps> {
213213
export class AlternateGPTPrompt extends PromptElement<DefaultAgentPromptProps> {
214214
async render(state: void, sizing: PromptSizing) {
215215
const tools = detectToolCapabilities(this.props.availableTools);
216-
const isGpt5 = this.props.modelFamily === 'gpt-5';
216+
const isGpt5 = this.props.modelFamily?.startsWith('gpt-5') === true;
217217

218218
return <InstructionMessage>
219219
<Tag name='gpt41AgentInstructions'>
@@ -620,7 +620,7 @@ export class ApplyPatchFormatInstructions extends PromptElement {
620620

621621
class ApplyPatchInstructions extends PromptElement<DefaultAgentPromptProps> {
622622
async render(state: void, sizing: PromptSizing) {
623-
const isGpt5 = this.props.modelFamily === 'gpt-5';
623+
const isGpt5 = this.props.modelFamily?.startsWith('gpt-5') === true;
624624
return <Tag name='applyPatchInstructions'>
625625
To edit files in the workspace, use the {ToolName.ApplyPatch} tool. If you have issues with it, you should first try to fix your patch and continue using {ToolName.ApplyPatch}. If you are stuck, you can fall back on the {ToolName.EditFile} tool. But {ToolName.ApplyPatch} is much faster and is the preferred tool.<br />
626626
{isGpt5 && <>Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br /></>}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export class AgentUserMessage extends PromptElement<AgentUserMessageProps> {
288288
const hasEditFileTool = !!this.props.availableTools?.find(tool => tool.name === ToolName.EditFile);
289289
const hasEditNotebookTool = !!this.props.availableTools?.find(tool => tool.name === ToolName.EditNotebook);
290290
const hasTerminalTool = !!this.props.availableTools?.find(tool => tool.name === ToolName.CoreRunInTerminal);
291-
const attachmentHint = (this.props.endpoint.family === 'gpt-4.1' || this.props.endpoint.family === 'gpt-5') && this.props.chatVariables.hasVariables() ?
291+
const attachmentHint = (this.props.endpoint.family === 'gpt-4.1' || this.props.endpoint.family.startsWith('gpt-5')) && this.props.chatVariables.hasVariables() ?
292292
' (See <attachments> above for file contents. You may not need to search or read the file again.)'
293293
: '';
294294
const hasToolsToEditNotebook = hasCreateFileTool || hasEditNotebookTool || hasReplaceStringTool || hasApplyPatchTool || hasEditFileTool;
@@ -360,7 +360,7 @@ class ToolReferencesHint extends PromptElement<ToolReferencesHintProps> {
360360
<Tag name='toolReferences'>
361361
The user attached the following tools to this message. The userRequest may refer to them using the tool name with "#". These tools are likely relevant to the user's query:<br />
362362
{this.props.toolReferences.map(tool => `- ${tool.name}`).join('\n')} <br />
363-
{this.props.modelFamily === 'gpt-5' && <>
363+
{this.props.modelFamily?.startsWith('gpt-5') === true && <>
364364
Start by using the most relevant tool attached to this message—the user expects you to act with it first.<br />
365365
</>}
366366
</Tag>
@@ -661,7 +661,7 @@ export class KeepGoingReminder extends PromptElement<IKeepGoingReminderProps> {
661661
}
662662

663663
async render(state: void, sizing: PromptSizing) {
664-
if (this.props.modelFamily === 'gpt-4.1' || this.props.modelFamily === 'gpt-5') {
664+
if (this.props.modelFamily === 'gpt-4.1' || (this.props.modelFamily?.startsWith('gpt-5') === true)) {
665665
if (this.configurationService.getExperimentBasedConfig(ConfigKey.EnableAlternateGptPrompt, this.experimentationService)) {
666666
// Extended reminder
667667
return <>
@@ -674,7 +674,7 @@ export class KeepGoingReminder extends PromptElement<IKeepGoingReminderProps> {
674674
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.<br />
675675
You are a highly capable and autonomous agent, and you can definitely solve this problem without needing to ask the user for further input.<br />
676676
</>;
677-
} else if (this.props.modelFamily === 'gpt-5') {
677+
} else if (this.props.modelFamily?.startsWith('gpt-5') === true) {
678678
return <>
679679
You are an agent—keep going until the user's query is completely resolved before ending your turn. ONLY stop if solved or genuinely blocked.<br />
680680
Take action when possible; the user expects you to do useful work without unnecessary questions.<br />
@@ -696,7 +696,7 @@ export class KeepGoingReminder extends PromptElement<IKeepGoingReminderProps> {
696696
}
697697

698698
function getExplanationReminder(modelFamily: string | undefined, hasTodoTool?: boolean) {
699-
return modelFamily === 'gpt-5' ?
699+
return modelFamily?.startsWith('gpt-5') === true ?
700700
<>
701701
Skip filler acknowledgements like “Sounds good” or “Okay, I will…”. Open with a purposeful one-liner about what you're doing next.<br />
702702
When sharing setup or run steps, present terminal commands in fenced code blocks with the correct language tag. Keep commands copyable and on separate lines.<br />

src/platform/endpoint/common/chatModelCapabilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function modelPrefersInstructionsAfterHistory(modelFamily: string) {
3636
* Model supports apply_patch as an edit tool.
3737
*/
3838
export async function modelSupportsApplyPatch(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
39-
if (model.family === 'gpt-4.1' || model.family === 'o4-mini' || model.family === 'gpt-5') {
39+
if (model.family === 'gpt-4.1' || model.family === 'o4-mini' || model.family.startsWith('gpt-5')) {
4040
return true;
4141
}
4242
return await getSha256Hash(model.family) === 'a99dd17dfee04155d863268596b7f6dd36d0a6531cd326348dbe7416142a21a3';
@@ -46,7 +46,7 @@ export async function modelSupportsApplyPatch(model: LanguageModelChat | IChatEn
4646
* Model prefers JSON notebook representation.
4747
*/
4848
export function modelPrefersJsonNotebookRepresentation(model: LanguageModelChat | IChatEndpoint): boolean {
49-
return model.family === 'gpt-4.1' || model.family === 'o4-mini' || model.family === 'gpt-5';
49+
return model.family === 'gpt-4.1' || model.family === 'o4-mini' || model.family.startsWith('gpt-5');
5050
}
5151

5252
/**

0 commit comments

Comments
 (0)