@aigne/openai 0.5.0 → 0.6.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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.1](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.6.0...openai-v0.6.1) (2025-07-01)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/core bumped to 1.28.1
11
+ * devDependencies
12
+ * @aigne/test-utils bumped to 0.4.13
13
+
14
+ ## [0.6.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.5.0...openai-v0.6.0) (2025-07-01)
15
+
16
+
17
+ ### Features
18
+
19
+ * **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))
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * The following workspace dependencies were updated
25
+ * dependencies
26
+ * @aigne/core bumped to 1.28.0
27
+ * devDependencies
28
+ * @aigne/test-utils bumped to 0.4.12
29
+
3
30
  ## [0.5.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.4.3...openai-v0.5.0) (2025-07-01)
4
31
 
5
32
 
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
- const text = chunk.delta.text?.text;
102
- if (text) fullText += text;
103
- if (chunk.delta.json) Object.assign(json, chunk.delta.json);
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
- const text = chunk.delta.text?.text;
102
- if (text) fullText += text;
103
- if (chunk.delta.json) Object.assign(json, chunk.delta.json);
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.5.0",
3
+ "version": "0.6.1",
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.27.0"
38
+ "@aigne/core": "^1.28.1"
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.11"
46
+ "@aigne/test-utils": "^0.4.13"
47
47
  },
48
48
  "scripts": {
49
49
  "lint": "tsc --noEmit",