@aigne/openai 0.5.0 → 0.6.0
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 +16 -0
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.5.0...openai-v0.6.0) (2025-07-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **example:** use AIGNE cli to run chat-bot example ([#198](https://github.com/AIGNE-io/aigne-framework/issues/198)) ([7085541](https://github.com/AIGNE-io/aigne-framework/commit/708554100692f2a557f7329ea78e46c3c870ce10))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/core bumped to 1.28.0
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @aigne/test-utils bumped to 0.4.12
|
|
18
|
+
|
|
3
19
|
## [0.5.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.4.3...openai-v0.5.0) (2025-07-01)
|
|
4
20
|
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -79,6 +79,7 @@ console.log(result);
|
|
|
79
79
|
## Streaming Responses
|
|
80
80
|
|
|
81
81
|
```typescript file="test/openai-chat-model.test.ts" region="example-openai-chat-model-stream"
|
|
82
|
+
import { isAgentResponseDelta } from "@aigne/core";
|
|
82
83
|
import { OpenAIChatModel } from "@aigne/openai";
|
|
83
84
|
|
|
84
85
|
const model = new OpenAIChatModel({
|
|
@@ -90,7 +91,6 @@ const stream = await model.invoke(
|
|
|
90
91
|
{
|
|
91
92
|
messages: [{ role: "user", content: "Hello, who are you?" }],
|
|
92
93
|
},
|
|
93
|
-
undefined,
|
|
94
94
|
{ streaming: true },
|
|
95
95
|
);
|
|
96
96
|
|
|
@@ -98,9 +98,11 @@ let fullText = "";
|
|
|
98
98
|
const json = {};
|
|
99
99
|
|
|
100
100
|
for await (const chunk of stream) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (isAgentResponseDelta(chunk)) {
|
|
102
|
+
const text = chunk.delta.text?.text;
|
|
103
|
+
if (text) fullText += text;
|
|
104
|
+
if (chunk.delta.json) Object.assign(json, chunk.delta.json);
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
console.log(fullText); // Output: "Hello! How can I assist you today?"
|
package/README.zh.md
CHANGED
|
@@ -79,6 +79,7 @@ console.log(result);
|
|
|
79
79
|
## 流式响应
|
|
80
80
|
|
|
81
81
|
```typescript file="test/openai-chat-model.test.ts" region="example-openai-chat-model-stream"
|
|
82
|
+
import { isAgentResponseDelta } from "@aigne/core";
|
|
82
83
|
import { OpenAIChatModel } from "@aigne/openai";
|
|
83
84
|
|
|
84
85
|
const model = new OpenAIChatModel({
|
|
@@ -90,7 +91,6 @@ const stream = await model.invoke(
|
|
|
90
91
|
{
|
|
91
92
|
messages: [{ role: "user", content: "Hello, who are you?" }],
|
|
92
93
|
},
|
|
93
|
-
undefined,
|
|
94
94
|
{ streaming: true },
|
|
95
95
|
);
|
|
96
96
|
|
|
@@ -98,9 +98,11 @@ let fullText = "";
|
|
|
98
98
|
const json = {};
|
|
99
99
|
|
|
100
100
|
for await (const chunk of stream) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (isAgentResponseDelta(chunk)) {
|
|
102
|
+
const text = chunk.delta.text?.text;
|
|
103
|
+
if (text) fullText += text;
|
|
104
|
+
if (chunk.delta.json) Object.assign(json, chunk.delta.json);
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
console.log(fullText); // Output: "Hello! How can I assist you today?"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "AIGNE OpenAI SDK for integrating with OpenAI's GPT models and API services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"nanoid": "^5.1.5",
|
|
36
36
|
"openai": "^4.87.3",
|
|
37
37
|
"zod": "^3.24.4",
|
|
38
|
-
"@aigne/core": "^1.
|
|
38
|
+
"@aigne/core": "^1.28.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/bun": "^1.2.12",
|
|
@@ -43,7 +43,7 @@
|
|
|
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.4.
|
|
46
|
+
"@aigne/test-utils": "^0.4.12"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"lint": "tsc --noEmit",
|