@aigne/openai 0.6.4 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/lib/cjs/openai-chat-model.js +8 -5
- package/lib/esm/openai-chat-model.js +8 -5
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.1](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.7.0...openai-v0.7.1) (2025-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/core bumped to 1.31.0
|
|
11
|
+
* devDependencies
|
|
12
|
+
* @aigne/test-utils bumped to 0.5.1
|
|
13
|
+
|
|
14
|
+
## [0.7.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.6.4...openai-v0.7.0) (2025-07-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* upgrade dependencies and adapt code to breaking changes ([#216](https://github.com/AIGNE-io/aigne-framework/issues/216)) ([f215ced](https://github.com/AIGNE-io/aigne-framework/commit/f215cedc1a57e321164064c33316e496eae8d25f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
* The following workspace dependencies were updated
|
|
25
|
+
* dependencies
|
|
26
|
+
* @aigne/core bumped to 1.30.0
|
|
27
|
+
* devDependencies
|
|
28
|
+
* @aigne/test-utils bumped to 0.5.0
|
|
29
|
+
|
|
3
30
|
## [0.6.4](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.6.3...openai-v0.6.4) (2025-07-02)
|
|
4
31
|
|
|
5
32
|
|
|
@@ -120,7 +120,7 @@ class OpenAIChatModel extends core_1.ChatModel {
|
|
|
120
120
|
stream: true,
|
|
121
121
|
};
|
|
122
122
|
const { jsonMode, responseFormat } = await this.getRunResponseFormat(input);
|
|
123
|
-
const stream = await this.client.chat.completions.create({
|
|
123
|
+
const stream = (await this.client.chat.completions.create({
|
|
124
124
|
...body,
|
|
125
125
|
tools: toolsFromInputTools(input.tools, {
|
|
126
126
|
addTypeToEmptyParameters: !this.supportsToolsEmptyParameters,
|
|
@@ -128,7 +128,7 @@ class OpenAIChatModel extends core_1.ChatModel {
|
|
|
128
128
|
tool_choice: input.toolChoice,
|
|
129
129
|
parallel_tool_calls: this.getParallelToolCalls(input),
|
|
130
130
|
response_format: responseFormat,
|
|
131
|
-
});
|
|
131
|
+
}));
|
|
132
132
|
if (input.responseFormat?.type !== "json_schema") {
|
|
133
133
|
return await this.extractResultFromStream(stream, false, true);
|
|
134
134
|
}
|
|
@@ -171,7 +171,10 @@ class OpenAIChatModel extends core_1.ChatModel {
|
|
|
171
171
|
return { jsonMode: false, responseFormat: undefined };
|
|
172
172
|
if (!this.supportsNativeStructuredOutputs) {
|
|
173
173
|
const jsonMode = input.responseFormat?.type === "json_schema";
|
|
174
|
-
return {
|
|
174
|
+
return {
|
|
175
|
+
jsonMode,
|
|
176
|
+
responseFormat: jsonMode ? { type: "json_object" } : undefined,
|
|
177
|
+
};
|
|
175
178
|
}
|
|
176
179
|
if (input.responseFormat?.type === "json_schema") {
|
|
177
180
|
return {
|
|
@@ -194,10 +197,10 @@ class OpenAIChatModel extends core_1.ChatModel {
|
|
|
194
197
|
const { jsonMode, responseFormat: resolvedResponseFormat } = await this.getRunResponseFormat({
|
|
195
198
|
responseFormat,
|
|
196
199
|
});
|
|
197
|
-
const res = await this.client.chat.completions.create({
|
|
200
|
+
const res = (await this.client.chat.completions.create({
|
|
198
201
|
...body,
|
|
199
202
|
response_format: resolvedResponseFormat,
|
|
200
|
-
});
|
|
203
|
+
}));
|
|
201
204
|
return this.extractResultFromStream(res, jsonMode);
|
|
202
205
|
}
|
|
203
206
|
async extractResultFromStream(stream, jsonMode, streaming) {
|
|
@@ -111,7 +111,7 @@ export class OpenAIChatModel extends ChatModel {
|
|
|
111
111
|
stream: true,
|
|
112
112
|
};
|
|
113
113
|
const { jsonMode, responseFormat } = await this.getRunResponseFormat(input);
|
|
114
|
-
const stream = await this.client.chat.completions.create({
|
|
114
|
+
const stream = (await this.client.chat.completions.create({
|
|
115
115
|
...body,
|
|
116
116
|
tools: toolsFromInputTools(input.tools, {
|
|
117
117
|
addTypeToEmptyParameters: !this.supportsToolsEmptyParameters,
|
|
@@ -119,7 +119,7 @@ export class OpenAIChatModel extends ChatModel {
|
|
|
119
119
|
tool_choice: input.toolChoice,
|
|
120
120
|
parallel_tool_calls: this.getParallelToolCalls(input),
|
|
121
121
|
response_format: responseFormat,
|
|
122
|
-
});
|
|
122
|
+
}));
|
|
123
123
|
if (input.responseFormat?.type !== "json_schema") {
|
|
124
124
|
return await this.extractResultFromStream(stream, false, true);
|
|
125
125
|
}
|
|
@@ -162,7 +162,10 @@ export class OpenAIChatModel extends ChatModel {
|
|
|
162
162
|
return { jsonMode: false, responseFormat: undefined };
|
|
163
163
|
if (!this.supportsNativeStructuredOutputs) {
|
|
164
164
|
const jsonMode = input.responseFormat?.type === "json_schema";
|
|
165
|
-
return {
|
|
165
|
+
return {
|
|
166
|
+
jsonMode,
|
|
167
|
+
responseFormat: jsonMode ? { type: "json_object" } : undefined,
|
|
168
|
+
};
|
|
166
169
|
}
|
|
167
170
|
if (input.responseFormat?.type === "json_schema") {
|
|
168
171
|
return {
|
|
@@ -185,10 +188,10 @@ export class OpenAIChatModel extends ChatModel {
|
|
|
185
188
|
const { jsonMode, responseFormat: resolvedResponseFormat } = await this.getRunResponseFormat({
|
|
186
189
|
responseFormat,
|
|
187
190
|
});
|
|
188
|
-
const res = await this.client.chat.completions.create({
|
|
191
|
+
const res = (await this.client.chat.completions.create({
|
|
189
192
|
...body,
|
|
190
193
|
response_format: resolvedResponseFormat,
|
|
191
|
-
});
|
|
194
|
+
}));
|
|
192
195
|
return this.extractResultFromStream(res, jsonMode);
|
|
193
196
|
}
|
|
194
197
|
async extractResultFromStream(stream, jsonMode, streaming) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "AIGNE OpenAI SDK for integrating with OpenAI's GPT models and API services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"nanoid": "^5.1.5",
|
|
36
|
-
"openai": "^
|
|
37
|
-
"zod": "^3.
|
|
38
|
-
"@aigne/core": "^1.
|
|
36
|
+
"openai": "^5.8.2",
|
|
37
|
+
"zod": "^3.25.67",
|
|
38
|
+
"@aigne/core": "^1.31.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/bun": "^1.2.
|
|
42
|
-
"@types/node": "^
|
|
41
|
+
"@types/bun": "^1.2.17",
|
|
42
|
+
"@types/node": "^24.0.10",
|
|
43
43
|
"npm-run-all": "^4.1.5",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"typescript": "^5.8.3",
|
|
46
|
-
"@aigne/test-utils": "^0.
|
|
46
|
+
"@aigne/test-utils": "^0.5.1"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"lint": "tsc --noEmit",
|