feat: model configuration to support different models (#183)

Co-authored-by: hiroki osame <hiroki.osame@gmail.com>
This commit is contained in:
Matthew Hirst
2023-04-01 12:46:12 +02:00
committed by GitHub
parent ebe83a493e
commit eee3bbfb84
5 changed files with 18 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import fs from 'fs/promises';
import path from 'path';
import os from 'os';
import ini from 'ini';
import type { TiktokenModel } from '@dqbd/tiktoken';
import { fileExists } from './fs.js';
import { KnownError } from './error.js';
@@ -60,6 +61,13 @@ const configParsers = {
return url;
},
model(model?: string) {
if (!model || model.length === 0) {
return 'gpt-3.5-turbo';
}
return model as TiktokenModel;
},
} as const;
type ConfigKeys = keyof typeof configParsers;