| 263 | } |
| 264 | |
| 265 | function getOptimalConfig(model: string, sources: string[], extensions: string[]): CodeIndexConfig { |
| 266 | const config = { |
| 267 | model, |
| 268 | sources, |
| 269 | extensions, |
| 270 | temperature: 0.2 |
| 271 | } as CodeIndexConfig; |
| 272 | |
| 273 | if (model.startsWith('gpt-3.5-turbo-16k')) { |
| 274 | config.max_input_tokens = 12000; |
| 275 | config.max_tokens = 3000; |
| 276 | } else if (model.startsWith('gpt-3.5-turbo-instruct')) { |
| 277 | throw new Error(`The 'gpt-3.5-turbo-instruct' model is not yet supported.`); |
| 278 | } else if (model.startsWith('gpt-3.5-turbo')) { |
| 279 | config.max_input_tokens = 3000; |
| 280 | config.max_tokens = 800; |
| 281 | } else if (model.startsWith('gpt-4-32k')) { |
| 282 | config.max_input_tokens = 24000; |
| 283 | config.max_tokens = 6000; |
| 284 | } else if (model.startsWith('gpt-4')) { |
| 285 | config.max_input_tokens = 6000; |
| 286 | config.max_tokens = 1500; |
| 287 | } else { |
| 288 | throw new Error(`The '${model}' model is not yet supported.`); |
| 289 | } |
| 290 | |
| 291 | return config; |
| 292 | } |