Update OpenAI dependency

This commit is contained in:
Wroclaw 2023-09-27 17:14:17 +02:00
parent 8ed2e758f8
commit 23ceca5cd3
8 changed files with 250 additions and 81 deletions

View file

@ -1,4 +1,4 @@
import { ChatCompletionFunctions, ChatCompletionRequestMessage, ChatCompletionRequestMessageFunctionCall } from "openai";
import { ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam } from "openai/resources/chat";
import { config } from "./index";
@ -13,6 +13,9 @@ type OpenAIFunctionRequestData<T extends nameTypeMap> = {
[name in keyof T]: T[name];
};
type ChatCompletionFunctions = ChatCompletionCreateParams.Function;
type ChatCompletionFunctionCall = ChatCompletionMessage.FunctionCall;
/**
* Represents the function that can be ran by the OpenAI model
*/
@ -61,7 +64,7 @@ export default class FunctionManager {
return rvalue;
}
public handleFunction(request: ChatCompletionRequestMessageFunctionCall): ChatCompletionRequestMessage {
public handleFunction(request: ChatCompletionFunctionCall): ChatCompletionMessageParam {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let parsedArguments: any;