diff --git a/src/funcitonManager.ts b/src/funcitonManager.ts index 008c14e..d351c15 100644 --- a/src/funcitonManager.ts +++ b/src/funcitonManager.ts @@ -61,14 +61,16 @@ export default class FunctionManager { } public handleFunction(request: ChatCompletionRequestMessageFunctionCall) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let parsedArguments: any; try { - const parsedArguments = JSON.parse(request.arguments ?? ""); - return this.store.get(request.name ?? "")?.execute(parsedArguments); + parsedArguments = JSON.parse(request.arguments ?? ""); } catch (e) { console.error("Function arguments raw: " + request.arguments); throw new Error(`Failed to parse the function JSON arguments when running function [${request.name}]`, {cause: e}); } + return this.store.get(request.name ?? "")?.execute(parsedArguments); } }