Skip to content

Commit

Permalink
fix(agentic chat): exclude deep-cody prompt for o1 models (#6725) (#6734
Browse files Browse the repository at this point in the history
)

This change ensures that the deep-cody prompt mixin is not applied to
the 'chat-preview' (o1) model, preventing potential issues with the
prompt generation.

## Test plan
Use o1 with agentic chat enabled and confirm the agentic chat prompt
isn't getting applied.

Backport
e3093fe
from #6725

Co-authored-by: Beatrix <[email protected]>
  • Loading branch information
hitesh-1997 and abeatrix authored Jan 22, 2025
1 parent ed6e90d commit 557e872
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/shared/src/prompt/prompt-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ const HEDGES_PREVENTION = ps`Answer positively without apologizing. `
/**
* Answer guidelines for the Deep Cody model.
*/
const DEEP_CODY = ps`Explain your reasoning in detail for coding questions. `
const AGENTIC_CHAT = ps`Explain your reasoning in detail for coding questions. `

/**
* Incompatible Models with Agentic Instructions
* Note: The chat-preview model series has limitations with detailed reasoning
* and chain-of-thought processes, necessitating their exclusion
*/
const agenticBlockedModels = ['chat-preview']

/**
* Prompt mixins elaborate every prompt presented to the LLM.
Expand Down Expand Up @@ -43,9 +50,13 @@ export class PromptMixin {
mixins.push(PromptMixin.hedging)
}

// Handle Agent specific prompts
if (humanMessage.agent === 'deep-cody' && !newMixins.length) {
mixins.push(new PromptMixin(HEDGES_PREVENTION.concat(DEEP_CODY)))
// Handle agent-specific prompts
if (
humanMessage.agent === 'deep-cody' &&
!newMixins.length &&
!agenticBlockedModels.some(m => modelID?.includes(m))
) {
mixins.push(new PromptMixin(AGENTIC_CHAT))
}

// Add new mixins to the list of mixins to be prepended to the next human message.
Expand Down

0 comments on commit 557e872

Please sign in to comment.