feat(api.ts, config.ts): add support for custom model selection in OpenAi class

feat(config.ts): add model validation in configValidators
This commit is contained in:
di-sukharev
2023-04-28 15:29:32 +08:00
parent f04757f8af
commit 51613c2aea
2 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -29,6 +29,8 @@ if (!apiKey && command !== 'config' && mode !== CONFIG_MODES.set) {
process.exit(1);
}
const MODEL = config?.model || 'gpt-3.5-turbo';
class OpenAi {
private openAiApiConfiguration = new OpenAiApiConfiguration({
apiKey: apiKey
@@ -47,7 +49,7 @@ class OpenAi {
): Promise<string | undefined> => {
try {
const { data } = await this.openAI.createChatCompletion({
model: 'gpt-3.5-turbo',
model: MODEL,
messages,
temperature: 0,
top_p: 0.1,