Skip to content

Commit 75891fc

Browse files
authored
Update openai types (#15)
Fixes #14 Ref: openai/openai-node#266
1 parent 1ab24fe commit 75891fc

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"devDependencies": {
2727
"@types/jest": "^29.5.3",
2828
"jest": "^29.6.1",
29-
"openai": "^4.2.0",
29+
"openai": "^4.10.0",
3030
"prettier": "^3.0.2",
3131
"ts-jest": "^29.1.1",
3232
"typescript": "^5.1.6"
@@ -37,4 +37,4 @@
3737
"prettier": {
3838
"trailingComma": "all"
3939
}
40-
}
40+
}

src/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import OpenAI from "openai";
22

3-
type OpenAIFunction = OpenAI.Chat.CompletionCreateParams.Function;
3+
type OpenAIFunction = OpenAI.Chat.ChatCompletionCreateParams.Function;
44

55
// Types representing the OpenAI function definitions. While the OpenAI client library
66
// does have types for function definitions, the properties are just Record<string, unknown>,

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import OpenAI from "openai";
22
import { Tiktoken, getEncoding } from "js-tiktoken";
33
import { FunctionDef, formatFunctionDefinitions } from "./functions";
44

5-
type Message = OpenAI.Chat.CreateChatCompletionRequestMessage;
6-
type Function = OpenAI.Chat.CompletionCreateParams.Function;
7-
type FunctionCall = OpenAI.Chat.CompletionCreateParams.FunctionCallOption;
5+
type Message = OpenAI.Chat.ChatCompletionMessageParam;
6+
type Function = OpenAI.Chat.ChatCompletionCreateParams.Function;
7+
type FunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption;
88

99
let encoder: Tiktoken | undefined;
1010

tests/token-counts.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import OpenAI from "openai";
22
import { promptTokensEstimate } from "../src";
33

4-
type Message = OpenAI.Chat.CreateChatCompletionRequestMessage;
5-
type Function = OpenAI.Chat.CompletionCreateParams.Function;
6-
type FunctionCall = OpenAI.Chat.CompletionCreateParams.FunctionCallOption;
4+
type Message = OpenAI.Chat.ChatCompletionMessageParam;
5+
type Function = OpenAI.Chat.ChatCompletionCreateParams.Function;
6+
type FunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption;
77
type Example = {
88
messages: Message[];
99
functions?: Function[];

0 commit comments

Comments
 (0)