functionManager: don't return empty function array for openai
openai doesn't accept empty function parameter, it was discovered after I removed the testing buildin function
This commit is contained in:
parent
24e85f535a
commit
74359067d0
2 changed files with 6 additions and 1 deletions
|
@ -246,7 +246,7 @@ async function executeFromQueue(channel: string) {
|
||||||
...config.chatCompletionParams,
|
...config.chatCompletionParams,
|
||||||
messages: OpenAImessages,
|
messages: OpenAImessages,
|
||||||
// FIXME: don't use new instance of FunctionManager
|
// FIXME: don't use new instance of FunctionManager
|
||||||
functions: new FunctionManager().getFunctions(),
|
functions: new FunctionManager().getFunctionsForOpenAi(),
|
||||||
});
|
});
|
||||||
|
|
||||||
logUsedTokens(answer, message, ++functionRanCounter);
|
logUsedTokens(answer, message, ++functionRanCounter);
|
||||||
|
|
|
@ -62,6 +62,11 @@ export default class FunctionManager {
|
||||||
return rvalue;
|
return rvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getFunctionsForOpenAi(): ChatCompletionFunctions[] | undefined {
|
||||||
|
const rvalue = this.getFunctions();
|
||||||
|
return rvalue.length > 0 ? rvalue : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public handleFunction(request: ChatCompletionFunctionCall): ChatCompletionMessageParam {
|
public handleFunction(request: ChatCompletionFunctionCall): ChatCompletionMessageParam {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let parsedArguments: any;
|
let parsedArguments: any;
|
||||||
|
|
Loading…
Reference in a new issue