@aigne/anthropic 0.4.0 → 0.5.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.5.1](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.5.0...anthropic-v0.5.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.5.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.4.0...anthropic-v0.5.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.4.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.3.10...anthropic-v0.4.0) (2025-07-01)
4
31
 
5
32
 
package/README.md CHANGED
@@ -82,6 +82,7 @@ console.log(result);
82
82
 
83
83
  ```typescript file="test/anthropic-chat-model.test.ts" region="example-anthropic-chat-model-streaming-async-generator"
84
84
  import { AnthropicChatModel } from "@aigne/anthropic";
85
+ import { isAgentResponseDelta } from "@aigne/core";
85
86
 
86
87
  const model = new AnthropicChatModel({
87
88
  apiKey: "your-api-key",
@@ -92,7 +93,6 @@ const stream = await model.invoke(
92
93
  {
93
94
  messages: [{ role: "user", content: "Tell me about yourself" }],
94
95
  },
95
- undefined,
96
96
  { streaming: true },
97
97
  );
98
98
 
@@ -100,9 +100,11 @@ let fullText = "";
100
100
  const json = {};
101
101
 
102
102
  for await (const chunk of stream) {
103
- const text = chunk.delta.text?.text;
104
- if (text) fullText += text;
105
- if (chunk.delta.json) Object.assign(json, chunk.delta.json);
103
+ if (isAgentResponseDelta(chunk)) {
104
+ const text = chunk.delta.text?.text;
105
+ if (text) fullText += text;
106
+ if (chunk.delta.json) Object.assign(json, chunk.delta.json);
107
+ }
106
108
  }
107
109
 
108
110
  console.log(fullText); // Output: "I'm Claude, an AI assistant created by Anthropic. How can I help you today?"
package/README.zh.md CHANGED
@@ -82,6 +82,7 @@ console.log(result);
82
82
 
83
83
  ```typescript file="test/anthropic-chat-model.test.ts" region="example-anthropic-chat-model-streaming-async-generator"
84
84
  import { AnthropicChatModel } from "@aigne/anthropic";
85
+ import { isAgentResponseDelta } from "@aigne/core";
85
86
 
86
87
  const model = new AnthropicChatModel({
87
88
  apiKey: "your-api-key",
@@ -92,7 +93,6 @@ const stream = await model.invoke(
92
93
  {
93
94
  messages: [{ role: "user", content: "Tell me about yourself" }],
94
95
  },
95
- undefined,
96
96
  { streaming: true },
97
97
  );
98
98
 
@@ -100,9 +100,11 @@ let fullText = "";
100
100
  const json = {};
101
101
 
102
102
  for await (const chunk of stream) {
103
- const text = chunk.delta.text?.text;
104
- if (text) fullText += text;
105
- if (chunk.delta.json) Object.assign(json, chunk.delta.json);
103
+ if (isAgentResponseDelta(chunk)) {
104
+ const text = chunk.delta.text?.text;
105
+ if (text) fullText += text;
106
+ if (chunk.delta.json) Object.assign(json, chunk.delta.json);
107
+ }
106
108
  }
107
109
 
108
110
  console.log(fullText); // Output: "I'm Claude, an AI assistant created by Anthropic. How can I help you today?"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/anthropic",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "AIGNE Anthropic SDK for integrating with Claude AI models",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@anthropic-ai/sdk": "^0.41.0",
36
36
  "zod": "^3.24.4",
37
- "@aigne/core": "^1.27.0"
37
+ "@aigne/core": "^1.28.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/bun": "^1.2.12",
@@ -42,7 +42,7 @@
42
42
  "npm-run-all": "^4.1.5",
43
43
  "rimraf": "^6.0.1",
44
44
  "typescript": "^5.8.3",
45
- "@aigne/test-utils": "^0.4.11"
45
+ "@aigne/test-utils": "^0.4.13"
46
46
  },
47
47
  "scripts": {
48
48
  "lint": "tsc --noEmit",