@aigne/anthropic 0.5.4 → 0.7.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 +43 -0
- package/lib/cjs/anthropic-chat-model.js +14 -3
- package/lib/esm/anthropic-chat-model.js +14 -3
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.6.1...anthropic-v0.7.0) (2025-07-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **core:** add jinja syntax support for prompt builder ([#230](https://github.com/AIGNE-io/aigne-framework/issues/230)) ([74436a7](https://github.com/AIGNE-io/aigne-framework/commit/74436a7faac0c59a32b0153481386162649f4357))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/core bumped to 1.32.0
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @aigne/test-utils bumped to 0.5.2
|
|
18
|
+
|
|
19
|
+
## [0.6.1](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.6.0...anthropic-v0.6.1) (2025-07-04)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
* The following workspace dependencies were updated
|
|
25
|
+
* dependencies
|
|
26
|
+
* @aigne/core bumped to 1.31.0
|
|
27
|
+
* devDependencies
|
|
28
|
+
* @aigne/test-utils bumped to 0.5.1
|
|
29
|
+
|
|
30
|
+
## [0.6.0](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.5.4...anthropic-v0.6.0) (2025-07-03)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* 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))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Dependencies
|
|
39
|
+
|
|
40
|
+
* The following workspace dependencies were updated
|
|
41
|
+
* dependencies
|
|
42
|
+
* @aigne/core bumped to 1.30.0
|
|
43
|
+
* devDependencies
|
|
44
|
+
* @aigne/test-utils bumped to 0.5.0
|
|
45
|
+
|
|
3
46
|
## [0.5.4](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.5.3...anthropic-v0.5.4) (2025-07-02)
|
|
4
47
|
|
|
5
48
|
|
|
@@ -139,7 +139,9 @@ class AnthropicChatModel extends core_1.ChatModel {
|
|
|
139
139
|
logs.push(JSON.stringify(chunk));
|
|
140
140
|
// handle streaming text
|
|
141
141
|
if (chunk.type === "content_block_delta" && chunk.delta.type === "text_delta") {
|
|
142
|
-
controller.enqueue({
|
|
142
|
+
controller.enqueue({
|
|
143
|
+
delta: { text: { text: chunk.delta.text } },
|
|
144
|
+
});
|
|
143
145
|
}
|
|
144
146
|
if (chunk.type === "content_block_start" && chunk.content_block.type === "tool_use") {
|
|
145
147
|
toolCalls[chunk.index] = {
|
|
@@ -237,7 +239,13 @@ function convertMessages({ messages, responseFormat }) {
|
|
|
237
239
|
throw new Error("Tool message must have string content");
|
|
238
240
|
msgs.push({
|
|
239
241
|
role: "user",
|
|
240
|
-
content: [
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: "tool_result",
|
|
245
|
+
tool_use_id: msg.toolCallId,
|
|
246
|
+
content: msg.content,
|
|
247
|
+
},
|
|
248
|
+
],
|
|
241
249
|
});
|
|
242
250
|
}
|
|
243
251
|
else if (msg.role === "user") {
|
|
@@ -300,7 +308,10 @@ function convertTools({ tools, toolChoice, disableParallelToolUse, }) {
|
|
|
300
308
|
choice = { type: "any", disable_parallel_tool_use: disableParallelToolUse };
|
|
301
309
|
}
|
|
302
310
|
else if (toolChoice === "auto") {
|
|
303
|
-
choice = {
|
|
311
|
+
choice = {
|
|
312
|
+
type: "auto",
|
|
313
|
+
disable_parallel_tool_use: disableParallelToolUse,
|
|
314
|
+
};
|
|
304
315
|
}
|
|
305
316
|
else if (toolChoice === "none") {
|
|
306
317
|
choice = { type: "none" };
|
|
@@ -133,7 +133,9 @@ export class AnthropicChatModel extends ChatModel {
|
|
|
133
133
|
logs.push(JSON.stringify(chunk));
|
|
134
134
|
// handle streaming text
|
|
135
135
|
if (chunk.type === "content_block_delta" && chunk.delta.type === "text_delta") {
|
|
136
|
-
controller.enqueue({
|
|
136
|
+
controller.enqueue({
|
|
137
|
+
delta: { text: { text: chunk.delta.text } },
|
|
138
|
+
});
|
|
137
139
|
}
|
|
138
140
|
if (chunk.type === "content_block_start" && chunk.content_block.type === "tool_use") {
|
|
139
141
|
toolCalls[chunk.index] = {
|
|
@@ -230,7 +232,13 @@ function convertMessages({ messages, responseFormat }) {
|
|
|
230
232
|
throw new Error("Tool message must have string content");
|
|
231
233
|
msgs.push({
|
|
232
234
|
role: "user",
|
|
233
|
-
content: [
|
|
235
|
+
content: [
|
|
236
|
+
{
|
|
237
|
+
type: "tool_result",
|
|
238
|
+
tool_use_id: msg.toolCallId,
|
|
239
|
+
content: msg.content,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
234
242
|
});
|
|
235
243
|
}
|
|
236
244
|
else if (msg.role === "user") {
|
|
@@ -293,7 +301,10 @@ function convertTools({ tools, toolChoice, disableParallelToolUse, }) {
|
|
|
293
301
|
choice = { type: "any", disable_parallel_tool_use: disableParallelToolUse };
|
|
294
302
|
}
|
|
295
303
|
else if (toolChoice === "auto") {
|
|
296
|
-
choice = {
|
|
304
|
+
choice = {
|
|
305
|
+
type: "auto",
|
|
306
|
+
disable_parallel_tool_use: disableParallelToolUse,
|
|
307
|
+
};
|
|
297
308
|
}
|
|
298
309
|
else if (toolChoice === "none") {
|
|
299
310
|
choice = { type: "none" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/anthropic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "AIGNE Anthropic SDK for integrating with Claude AI models",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@anthropic-ai/sdk": "^0.
|
|
36
|
-
"zod": "^3.
|
|
37
|
-
"@aigne/core": "^1.
|
|
35
|
+
"@anthropic-ai/sdk": "^0.55.1",
|
|
36
|
+
"zod": "^3.25.67",
|
|
37
|
+
"@aigne/core": "^1.32.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/bun": "^1.2.
|
|
41
|
-
"@types/node": "^
|
|
40
|
+
"@types/bun": "^1.2.17",
|
|
41
|
+
"@types/node": "^24.0.10",
|
|
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.
|
|
45
|
+
"@aigne/test-utils": "^0.5.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"lint": "tsc --noEmit",
|