Skip to content

Commit 83fbd84

Browse files
authored
Merge branch 'master' into perf/wassim-chegham-issue-1310
2 parents e1b0d57 + a1a1253 commit 83fbd84

File tree

12 files changed

+58
-64
lines changed

12 files changed

+58
-64
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
33
{
4-
"name": "Debian",
5-
"build": {
6-
"dockerfile": "Dockerfile"
4+
"name": "Development",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
6+
"features": {
7+
"ghcr.io/devcontainers/features/node:1": {}
8+
},
9+
"postCreateCommand": "yarn install",
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"esbenp.prettier-vscode"
14+
]
15+
}
716
}
8-
9-
// Features to add to the dev container. More info: https://containers.dev/features.
10-
// "features": {},
11-
12-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13-
// "forwardPorts": [],
14-
15-
// Configure tool-specific properties.
16-
// "customizations": {},
17-
18-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
19-
// "remoteUser": "root"
2017
}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.85.2"
2+
".": "4.85.4"
33
}

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 4.85.4 (2025-02-22)
4+
5+
Full Changelog: [v4.85.3...v4.85.4](https://github.com/openai/openai-node/compare/v4.85.3...v4.85.4)
6+
7+
### Chores
8+
9+
* **internal:** fix devcontainers setup ([#1343](https://github.com/openai/openai-node/issues/1343)) ([cb1ec90](https://github.com/openai/openai-node/commit/cb1ec907832e325bc29abe94ae325e0477cb87d1))
10+
11+
## 4.85.3 (2025-02-20)
12+
13+
Full Changelog: [v4.85.2...v4.85.3](https://github.com/openai/openai-node/compare/v4.85.2...v4.85.3)
14+
15+
### Bug Fixes
16+
17+
* **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([2672160](https://github.com/openai/openai-node/commit/26721608e61949daa9592483e89b79230bb9198a))
18+
319
## 4.85.2 (2025-02-18)
420

521
Full Changelog: [v4.85.1...v4.85.2](https://github.com/openai/openai-node/compare/v4.85.1...v4.85.2)

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openai/openai",
3-
"version": "4.85.2",
3+
"version": "4.85.4",
44
"exports": {
55
".": "./index.ts",
66
"./helpers/zod": "./helpers/zod.ts",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openai",
3-
"version": "4.85.2",
3+
"version": "4.85.4",
44
"description": "The official TypeScript library for the OpenAI API",
55
"author": "OpenAI <[email protected]>",
66
"types": "dist/index.d.ts",

src/lib/parser.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,15 @@ export function maybeParseChatCompletion<
119119
...completion,
120120
choices: completion.choices.map((choice) => ({
121121
...choice,
122-
message: { ...choice.message, parsed: null, tool_calls: choice.message.tool_calls ?? [] },
122+
message: {
123+
...choice.message,
124+
parsed: null,
125+
...(choice.message.tool_calls ?
126+
{
127+
tool_calls: choice.message.tool_calls,
128+
}
129+
: undefined),
130+
},
123131
})),
124132
};
125133
}
@@ -144,7 +152,12 @@ export function parseChatCompletion<
144152
...choice,
145153
message: {
146154
...choice.message,
147-
tool_calls: choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? [],
155+
...(choice.message.tool_calls ?
156+
{
157+
tool_calls:
158+
choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? undefined,
159+
}
160+
: undefined),
148161
parsed:
149162
choice.message.content && !choice.message.refusal ?
150163
parseResponseFormat(params, choice.message.content)

src/resources/beta/chat/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export interface ParsedFunctionToolCall extends ChatCompletionMessageToolCall {
5050

5151
export interface ParsedChatCompletionMessage<ParsedT> extends ChatCompletionMessage {
5252
parsed: ParsedT | null;
53-
tool_calls: Array<ParsedFunctionToolCall>;
53+
tool_calls?: Array<ParsedFunctionToolCall>;
5454
}
5555

5656
export interface ParsedChoice<ParsedT> extends ChatCompletion.Choice {

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '4.85.2'; // x-release-please-version
1+
export const VERSION = '4.85.4'; // x-release-please-version

tests/lib/ChatCompletionRunFunctions.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ describe('resource completions', () => {
628628
content: "it's raining",
629629
parsed: null,
630630
refusal: null,
631-
tool_calls: [],
631+
tool_calls: undefined,
632632
},
633633
]);
634634
expect(listener.functionCallResults).toEqual([`it's raining`]);
@@ -876,7 +876,7 @@ describe('resource completions', () => {
876876
content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}',
877877
parsed: null,
878878
refusal: null,
879-
tool_calls: [],
879+
tool_calls: undefined,
880880
},
881881
]);
882882
expect(listener.functionCallResults).toEqual(['3']);
@@ -1125,7 +1125,7 @@ describe('resource completions', () => {
11251125
content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}',
11261126
parsed: null,
11271127
refusal: null,
1128-
tool_calls: [],
1128+
tool_calls: undefined,
11291129
},
11301130
]);
11311131
expect(listener.functionCallResults).toEqual([`must be an object`, '3']);
@@ -1443,7 +1443,7 @@ describe('resource completions', () => {
14431443
content: "it's raining",
14441444
parsed: null,
14451445
refusal: null,
1446-
tool_calls: [],
1446+
tool_calls: undefined,
14471447
},
14481448
]);
14491449
expect(listener.functionCallResults).toEqual([
@@ -1572,7 +1572,7 @@ describe('resource completions', () => {
15721572
content: "it's raining",
15731573
parsed: null,
15741574
refusal: null,
1575-
tool_calls: [],
1575+
tool_calls: undefined,
15761576
},
15771577
]);
15781578
expect(listener.eventFunctionCallResults).toEqual([`it's raining`]);
@@ -1795,7 +1795,7 @@ describe('resource completions', () => {
17951795
content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}',
17961796
parsed: null,
17971797
refusal: null,
1798-
tool_calls: [],
1798+
tool_calls: undefined,
17991799
},
18001800
]);
18011801
expect(listener.eventFunctionCallResults).toEqual(['3']);
@@ -1997,7 +1997,7 @@ describe('resource completions', () => {
19971997
content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}',
19981998
parsed: null,
19991999
refusal: null,
2000-
tool_calls: [],
2000+
tool_calls: undefined,
20012001
},
20022002
]);
20032003
expect(listener.eventFunctionCallResults).toEqual([`must be an object`, '3']);
@@ -2301,7 +2301,7 @@ describe('resource completions', () => {
23012301
content: "it's raining",
23022302
parsed: null,
23032303
refusal: null,
2304-
tool_calls: [],
2304+
tool_calls: undefined,
23052305
},
23062306
]);
23072307
expect(listener.eventFunctionCallResults).toEqual([
@@ -2347,7 +2347,7 @@ describe('resource completions', () => {
23472347
content: 'The weather is great today!',
23482348
parsed: null,
23492349
refusal: null,
2350-
tool_calls: [],
2350+
tool_calls: undefined,
23512351
});
23522352
await listener.sanityCheck();
23532353
});
@@ -2386,7 +2386,7 @@ describe('resource completions', () => {
23862386
content: 'The weather is great today!',
23872387
parsed: null,
23882388
refusal: null,
2389-
tool_calls: [],
2389+
tool_calls: undefined,
23902390
});
23912391
await listener.sanityCheck();
23922392
});

0 commit comments

Comments
 (0)