@aigne/anthropic 0.4.0 → 0.5.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.5.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.4.0...anthropic-v0.5.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.4.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.3.10...anthropic-v0.4.0) (2025-07-01)
|
|
4
20
|
|
|
5
21
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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.
|
|
3
|
+
"version": "0.5.0",
|
|
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.
|
|
37
|
+
"@aigne/core": "^1.28.0"
|
|
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.
|
|
45
|
+
"@aigne/test-utils": "^0.4.12"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"lint": "tsc --noEmit",
|