Skip to content

Commit

Permalink
Update openai types (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmarr authored Sep 28, 2023
1 parent 1ab24fe commit 75891fc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -37,4 +37,4 @@
"prettier": {
"trailingComma": "all"
}
}
}
2 changes: 1 addition & 1 deletion src/functions.ts
Original file line number Diff line number Diff line change
@@ -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<string, unknown>,
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions tests/token-counts.test.ts
Original file line number Diff line number Diff line change
@@ -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[];
Expand Down

0 comments on commit 75891fc

Please sign in to comment.