Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Config {
modelFormat = 'deepseek';
} else if (modelName.startsWith('stable-code')) {
modelFormat = 'stable-code';
} else if (modelName.startsWith('codegemma')) {
modelFormat = 'codegemma';
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/prompts/processors/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ModelFormat = 'codellama' | 'deepseek' | 'stable-code';
export type ModelFormat = 'codellama' | 'deepseek' | 'stable-code' | 'codegemma';

export function adaptPrompt(args: { format: ModelFormat, prefix: string, suffix: string }): { prompt: string, stop: string[] } {

Expand Down Expand Up @@ -26,6 +26,13 @@ export function adaptPrompt(args: { format: ModelFormat, prefix: string, suffix:
};
}

// Codegemma FIM
if (args.format === 'codegemma') {
return {
prompt: `<|fim_prefix|>${args.prefix}<|fim_suffix|>${args.suffix}<|fim_middle|>`,
stop: ['<|file_separator|>']
}
}
// Codellama FIM
return {
prompt: `<PRE> ${args.prefix} <SUF> ${args.suffix} <MID>`,
Expand Down