Skip to content

Commit

Permalink
fix: chunkedPrompt API function had wrong input parameter type
Browse files Browse the repository at this point in the history
  • Loading branch information
chhoumann committed Mar 5, 2024
1 parent 9b6fd98 commit 8d8bb3c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/quickAddApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class QuickAddApi {
chunkedPrompt: async (
text: string,
promptTemplate: string,
model: Model,
model: string,
settings?: Partial<{
variableName: string;
shouldAssignVariables: boolean;
Expand Down Expand Up @@ -201,24 +201,30 @@ export class QuickAddApi {
choiceExecutor
).format;

const modelProvider = getModelProvider(model.name);
const _model = getModelByName(model);

if (!_model) {
throw new Error(`Model ${model} not found.`);
}

const modelProvider = getModelProvider(model);

if (!modelProvider) {
throw new Error(
`Model '${model.name}' not found in any provider`
`Model '${_model.name}' not found in any provider`
);
}


if (!modelProvider.apiKey) {
throw new Error(
`Model '${model.name}' requires an API key`
`Model '${_model.name}' requires an API key`
);
}

const assistantRes = await ChunkedPrompt(
{
model,
model: _model,
text,
promptTemplate,
chunkSeparator: settings?.chunkSeparator ?? /\n/,
Expand Down

0 comments on commit 8d8bb3c

Please sign in to comment.