Skip to content

Commit

Permalink
fix(openai): Fix type import issue (#6695)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 authored Sep 4, 2024
1 parent ad44586 commit 890d24c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libs/langchain-openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {
"@langchain/core": ">=0.2.26 <0.3.0",
"js-tiktoken": "^1.0.12",
"openai": "^4.55.0",
"openai": "^4.57.3",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.3"
},
Expand Down
4 changes: 2 additions & 2 deletions libs/langchain-openai/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import type {
ResponseFormatJSONObject,
ResponseFormatJSONSchema,
} from "openai/resources/shared";
import { ParsedChatCompletion } from "openai/resources/beta/chat/completions.mjs";
import type {
AzureOpenAIInput,
OpenAICallOptions,
Expand Down Expand Up @@ -1615,7 +1614,8 @@ export class ChatOpenAI<
async betaParsedCompletionWithRetry(
request: OpenAIClient.Chat.ChatCompletionCreateParamsNonStreaming,
options?: OpenAICoreRequestOptions
): Promise<ParsedChatCompletion<null>> {
// Avoid relying importing a beta type with no official entrypoint
): Promise<ReturnType<OpenAIClient["beta"]["chat"]["completions"]["parse"]>> {
const requestOptions = this._getClientOptions(options);
return this.caller.call(async () => {
try {
Expand Down
28 changes: 23 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12300,7 +12300,7 @@ __metadata:
jest: ^29.5.0
jest-environment-node: ^29.6.4
js-tiktoken: ^1.0.12
openai: ^4.55.0
openai: ^4.57.3
prettier: ^2.8.3
release-it: ^17.6.0
rimraf: ^5.0.1
Expand Down Expand Up @@ -19003,6 +19003,13 @@ __metadata:
languageName: node
linkType: hard

"@types/qs@npm:^6.9.15":
version: 6.9.15
resolution: "@types/qs@npm:6.9.15"
checksum: 97d8208c2b82013b618e7a9fc14df6bd40a73e1385ac479b6896bafc7949a46201c15f42afd06e86a05e914f146f495f606b6fb65610cc60cf2e0ff743ec38a2
languageName: node
linkType: hard

"@types/range-parser@npm:*":
version: 1.2.4
resolution: "@types/range-parser@npm:1.2.4"
Expand Down Expand Up @@ -35228,25 +35235,27 @@ __metadata:
languageName: node
linkType: hard

"openai@npm:^4.55.0":
version: 4.55.0
resolution: "openai@npm:4.55.0"
"openai@npm:^4.57.3":
version: 4.57.3
resolution: "openai@npm:4.57.3"
dependencies:
"@types/node": ^18.11.18
"@types/node-fetch": ^2.6.4
"@types/qs": ^6.9.15
abort-controller: ^3.0.0
agentkeepalive: ^4.2.1
form-data-encoder: 1.7.2
formdata-node: ^4.3.2
node-fetch: ^2.6.7
qs: ^6.10.3
peerDependencies:
zod: ^3.23.8
peerDependenciesMeta:
zod:
optional: true
bin:
openai: bin/cli
checksum: b2b1daa976516262e08e182ee982976a1dc615eebd250bbd71f4122740ebeeb207a20af6d35c718b67f1c3457196b524667a0c7fa417ab4e119020b5c1f5cd74
checksum: 6e8cef99975af5fd8e9a06685f05396a6fabecda38bd77fa62db4b7ea9bdfa0b4c762c5f74e99e42212af81f74f50748c5034bf78c9abcf74cc6eb984f3dcffa
languageName: node
linkType: hard

Expand Down Expand Up @@ -37361,6 +37370,15 @@ __metadata:
languageName: node
linkType: hard

"qs@npm:^6.10.3":
version: 6.13.0
resolution: "qs@npm:6.13.0"
dependencies:
side-channel: ^1.0.6
checksum: e9404dc0fc2849245107108ce9ec2766cde3be1b271de0bf1021d049dc5b98d1a2901e67b431ac5509f865420a7ed80b7acb3980099fe1c118a1c5d2e1432ad8
languageName: node
linkType: hard

"querystringify@npm:^2.1.1":
version: 2.2.0
resolution: "querystringify@npm:2.2.0"
Expand Down

0 comments on commit 890d24c

Please sign in to comment.