diff --git a/package-lock.json b/package-lock.json index 94e3806..743222a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "devDependencies": { "@types/jest": "^29.5.3", "jest": "^29.6.1", - "openai": "^4.2.0", + "openai": "^4.10.0", "prettier": "^3.0.2", "ts-jest": "^29.1.1", "typescript": "^5.1.6" @@ -3089,9 +3089,9 @@ } }, "node_modules/openai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.2.0.tgz", - "integrity": "sha512-zfvpO2eITIxIjTG8T6Cek7NB2dMvP/LW0TRUJ4P9E8+qbBNKw00DrtfF64b+fAV2+wUYCVyynT6iSycJ//TtbA==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.10.0.tgz", + "integrity": "sha512-II4b5/7qzwYkqA9MSjgqdofCc798EW+dtF2h6qNaVLet+qO7FShAJTWnoyzb50J4ZH1rPxRFAsmDLIhY3PT6DQ==", "dev": true, "dependencies": { "@types/node": "^18.11.18", diff --git a/package.json b/package.json index 9717443..5b689b5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "devDependencies": { "@types/jest": "^29.5.3", "jest": "^29.6.1", - "openai": "^4.2.0", + "openai": "^4.10.0", "prettier": "^3.0.2", "ts-jest": "^29.1.1", "typescript": "^5.1.6" @@ -37,4 +37,4 @@ "prettier": { "trailingComma": "all" } -} \ No newline at end of file +} diff --git a/src/functions.ts b/src/functions.ts index cd917f3..51e3c10 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -1,6 +1,6 @@ import OpenAI from "openai"; -type OpenAIFunction = OpenAI.Chat.CompletionCreateParams.Function; +type OpenAIFunction = OpenAI.Chat.ChatCompletionCreateParams.Function; // Types representing the OpenAI function definitions. While the OpenAI client library // does have types for function definitions, the properties are just Record, diff --git a/src/index.ts b/src/index.ts index 243c99b..f27dd84 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,9 +2,9 @@ import OpenAI from "openai"; import { Tiktoken, getEncoding } from "js-tiktoken"; import { FunctionDef, formatFunctionDefinitions } from "./functions"; -type Message = OpenAI.Chat.CreateChatCompletionRequestMessage; -type Function = OpenAI.Chat.CompletionCreateParams.Function; -type FunctionCall = OpenAI.Chat.CompletionCreateParams.FunctionCallOption; +type Message = OpenAI.Chat.ChatCompletionMessageParam; +type Function = OpenAI.Chat.ChatCompletionCreateParams.Function; +type FunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption; let encoder: Tiktoken | undefined; diff --git a/tests/token-counts.test.ts b/tests/token-counts.test.ts index df93e4f..5eb8753 100644 --- a/tests/token-counts.test.ts +++ b/tests/token-counts.test.ts @@ -1,9 +1,9 @@ import OpenAI from "openai"; import { promptTokensEstimate } from "../src"; -type Message = OpenAI.Chat.CreateChatCompletionRequestMessage; -type Function = OpenAI.Chat.CompletionCreateParams.Function; -type FunctionCall = OpenAI.Chat.CompletionCreateParams.FunctionCallOption; +type Message = OpenAI.Chat.ChatCompletionMessageParam; +type Function = OpenAI.Chat.ChatCompletionCreateParams.Function; +type FunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption; type Example = { messages: Message[]; functions?: Function[];