From 8568f6b089223e2c7d23499ac9fa871d01b995c0 Mon Sep 17 00:00:00 2001 From: Gordon Mickel Date: Fri, 16 Aug 2024 22:59:49 +0200 Subject: [PATCH] add: check for supported models when using prompt caching --- src/cli/index.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 5677139..e18d727 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -49,7 +49,11 @@ export function cli(_args: string[]) { .command('task') .description('Start an AI-assisted coding task') .option('-p, --path ', 'Path to the codebase', '.') - .option('-m, --model ', 'Specify the AI model to use') + .option( + '-m, --model ', + 'Specify the AI model to use', + 'claude-3-5-sonnet-20240620', + ) .option( '-c, --context ', 'Specify files or directories to include in the task context. Can be file paths, directory paths, or glob patterns. Multiple entries should be space-separated.', @@ -167,6 +171,19 @@ Note: see "query parameters" at https://docs.github.com/en/rest/issues/issues?ap ); process.exit(1); } + if ( + options.promptCache && + (!options.model || + (!options.model.includes('claude-3-5-sonnet') && + !options.model.includes('claude-3-haiku'))) + ) { + console.error( + chalk.red( + 'Error: --prompt-cache is only available for Claude-3.5 Sonnet and Claude-3 Haiku models', + ), + ); + process.exit(1); + } if (options.redo) { try {