@aigne/anthropic 0.14.5-beta.3 → 0.14.5-beta.5
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.14.5-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.5-beta.4...anthropic-v0.14.5-beta.5) (2025-11-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/core bumped to 1.66.0-beta.4
|
|
11
|
+
* devDependencies
|
|
12
|
+
* @aigne/test-utils bumped to 0.5.58-beta.5
|
|
13
|
+
|
|
14
|
+
## [0.14.5-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.5-beta.3...anthropic-v0.14.5-beta.4) (2025-11-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add dynamic model options resolution with getter pattern ([#708](https://github.com/AIGNE-io/aigne-framework/issues/708)) ([5ed5085](https://github.com/AIGNE-io/aigne-framework/commit/5ed5085203763c70194853c56edc13acf56d81c6))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
* The following workspace dependencies were updated
|
|
25
|
+
* dependencies
|
|
26
|
+
* @aigne/core bumped to 1.66.0-beta.3
|
|
27
|
+
* devDependencies
|
|
28
|
+
* @aigne/test-utils bumped to 0.5.58-beta.4
|
|
29
|
+
|
|
3
30
|
## [0.14.5-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.5-beta.2...anthropic-v0.14.5-beta.3) (2025-11-05)
|
|
4
31
|
|
|
5
32
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
2
|
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
3
|
import Anthropic, { type ClientOptions } from "@anthropic-ai/sdk";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -95,7 +95,36 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
95
95
|
*/
|
|
96
96
|
protected _client?: Anthropic;
|
|
97
97
|
get client(): Anthropic;
|
|
98
|
-
get modelOptions():
|
|
98
|
+
get modelOptions(): Partial<{
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
model?: string | {
|
|
101
|
+
$get: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
temperature?: number | {
|
|
104
|
+
$get: string;
|
|
105
|
+
} | undefined;
|
|
106
|
+
topP?: number | {
|
|
107
|
+
$get: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
frequencyPenalty?: number | {
|
|
110
|
+
$get: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
presencePenalty?: number | {
|
|
113
|
+
$get: string;
|
|
114
|
+
} | undefined;
|
|
115
|
+
parallelToolCalls?: boolean | {
|
|
116
|
+
$get: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
modalities?: {
|
|
119
|
+
$get: string;
|
|
120
|
+
} | import("@aigne/core").Modality[] | undefined;
|
|
121
|
+
preferInputFileType?: "file" | "url" | {
|
|
122
|
+
$get: string;
|
|
123
|
+
} | undefined;
|
|
124
|
+
reasoningEffort?: number | {
|
|
125
|
+
$get: string;
|
|
126
|
+
} | "minimal" | "low" | "medium" | "high" | undefined;
|
|
127
|
+
}> | undefined;
|
|
99
128
|
get credential(): {
|
|
100
129
|
apiKey: string | undefined;
|
|
101
130
|
model: string;
|
|
@@ -106,7 +135,7 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
106
135
|
* @param input - The input to process
|
|
107
136
|
* @returns The processed output from the model
|
|
108
137
|
*/
|
|
109
|
-
process(input: ChatModelInput): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
138
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
110
139
|
private _process;
|
|
111
140
|
private extractResultFromAnthropicStream;
|
|
112
141
|
private requestStructuredOutput;
|
|
@@ -102,17 +102,17 @@ class AnthropicChatModel extends core_1.ChatModel {
|
|
|
102
102
|
* @param input - The input to process
|
|
103
103
|
* @returns The processed output from the model
|
|
104
104
|
*/
|
|
105
|
-
process(input) {
|
|
106
|
-
return this._process(input);
|
|
105
|
+
process(input, options) {
|
|
106
|
+
return this._process(input, options);
|
|
107
107
|
}
|
|
108
|
-
async _process(input) {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
108
|
+
async _process(input, options) {
|
|
109
|
+
const modelOptions = await this.getModelOptions(input, options);
|
|
110
|
+
const model = modelOptions.model || this.credential.model;
|
|
111
|
+
const disableParallelToolUse = modelOptions.parallelToolCalls === false;
|
|
112
112
|
const body = {
|
|
113
113
|
model,
|
|
114
|
-
temperature:
|
|
115
|
-
top_p:
|
|
114
|
+
temperature: modelOptions.temperature,
|
|
115
|
+
top_p: modelOptions.topP,
|
|
116
116
|
// TODO: make dynamic based on model https://docs.anthropic.com/en/docs/about-claude/models/all-models
|
|
117
117
|
max_tokens: this.getMaxTokens(model),
|
|
118
118
|
...(await convertMessages(input)),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
2
|
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
3
|
import Anthropic, { type ClientOptions } from "@anthropic-ai/sdk";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -95,7 +95,36 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
95
95
|
*/
|
|
96
96
|
protected _client?: Anthropic;
|
|
97
97
|
get client(): Anthropic;
|
|
98
|
-
get modelOptions():
|
|
98
|
+
get modelOptions(): Partial<{
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
model?: string | {
|
|
101
|
+
$get: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
temperature?: number | {
|
|
104
|
+
$get: string;
|
|
105
|
+
} | undefined;
|
|
106
|
+
topP?: number | {
|
|
107
|
+
$get: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
frequencyPenalty?: number | {
|
|
110
|
+
$get: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
presencePenalty?: number | {
|
|
113
|
+
$get: string;
|
|
114
|
+
} | undefined;
|
|
115
|
+
parallelToolCalls?: boolean | {
|
|
116
|
+
$get: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
modalities?: {
|
|
119
|
+
$get: string;
|
|
120
|
+
} | import("@aigne/core").Modality[] | undefined;
|
|
121
|
+
preferInputFileType?: "file" | "url" | {
|
|
122
|
+
$get: string;
|
|
123
|
+
} | undefined;
|
|
124
|
+
reasoningEffort?: number | {
|
|
125
|
+
$get: string;
|
|
126
|
+
} | "minimal" | "low" | "medium" | "high" | undefined;
|
|
127
|
+
}> | undefined;
|
|
99
128
|
get credential(): {
|
|
100
129
|
apiKey: string | undefined;
|
|
101
130
|
model: string;
|
|
@@ -106,7 +135,7 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
106
135
|
* @param input - The input to process
|
|
107
136
|
* @returns The processed output from the model
|
|
108
137
|
*/
|
|
109
|
-
process(input: ChatModelInput): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
138
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
110
139
|
private _process;
|
|
111
140
|
private extractResultFromAnthropicStream;
|
|
112
141
|
private requestStructuredOutput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
2
|
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
3
|
import Anthropic, { type ClientOptions } from "@anthropic-ai/sdk";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -95,7 +95,36 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
95
95
|
*/
|
|
96
96
|
protected _client?: Anthropic;
|
|
97
97
|
get client(): Anthropic;
|
|
98
|
-
get modelOptions():
|
|
98
|
+
get modelOptions(): Partial<{
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
model?: string | {
|
|
101
|
+
$get: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
temperature?: number | {
|
|
104
|
+
$get: string;
|
|
105
|
+
} | undefined;
|
|
106
|
+
topP?: number | {
|
|
107
|
+
$get: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
frequencyPenalty?: number | {
|
|
110
|
+
$get: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
presencePenalty?: number | {
|
|
113
|
+
$get: string;
|
|
114
|
+
} | undefined;
|
|
115
|
+
parallelToolCalls?: boolean | {
|
|
116
|
+
$get: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
modalities?: {
|
|
119
|
+
$get: string;
|
|
120
|
+
} | import("@aigne/core").Modality[] | undefined;
|
|
121
|
+
preferInputFileType?: "file" | "url" | {
|
|
122
|
+
$get: string;
|
|
123
|
+
} | undefined;
|
|
124
|
+
reasoningEffort?: number | {
|
|
125
|
+
$get: string;
|
|
126
|
+
} | "minimal" | "low" | "medium" | "high" | undefined;
|
|
127
|
+
}> | undefined;
|
|
99
128
|
get credential(): {
|
|
100
129
|
apiKey: string | undefined;
|
|
101
130
|
model: string;
|
|
@@ -106,7 +135,7 @@ export declare class AnthropicChatModel extends ChatModel {
|
|
|
106
135
|
* @param input - The input to process
|
|
107
136
|
* @returns The processed output from the model
|
|
108
137
|
*/
|
|
109
|
-
process(input: ChatModelInput): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
138
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
110
139
|
private _process;
|
|
111
140
|
private extractResultFromAnthropicStream;
|
|
112
141
|
private requestStructuredOutput;
|
|
@@ -96,17 +96,17 @@ export class AnthropicChatModel extends ChatModel {
|
|
|
96
96
|
* @param input - The input to process
|
|
97
97
|
* @returns The processed output from the model
|
|
98
98
|
*/
|
|
99
|
-
process(input) {
|
|
100
|
-
return this._process(input);
|
|
99
|
+
process(input, options) {
|
|
100
|
+
return this._process(input, options);
|
|
101
101
|
}
|
|
102
|
-
async _process(input) {
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
102
|
+
async _process(input, options) {
|
|
103
|
+
const modelOptions = await this.getModelOptions(input, options);
|
|
104
|
+
const model = modelOptions.model || this.credential.model;
|
|
105
|
+
const disableParallelToolUse = modelOptions.parallelToolCalls === false;
|
|
106
106
|
const body = {
|
|
107
107
|
model,
|
|
108
|
-
temperature:
|
|
109
|
-
top_p:
|
|
108
|
+
temperature: modelOptions.temperature,
|
|
109
|
+
top_p: modelOptions.topP,
|
|
110
110
|
// TODO: make dynamic based on model https://docs.anthropic.com/en/docs/about-claude/models/all-models
|
|
111
111
|
max_tokens: this.getMaxTokens(model),
|
|
112
112
|
...(await convertMessages(input)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/anthropic",
|
|
3
|
-
"version": "0.14.5-beta.
|
|
3
|
+
"version": "0.14.5-beta.5",
|
|
4
4
|
"description": "AIGNE Anthropic SDK for integrating with Claude AI models",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@anthropic-ai/sdk": "^0.63.0",
|
|
39
39
|
"zod": "^3.25.67",
|
|
40
|
-
"@aigne/
|
|
41
|
-
"@aigne/
|
|
40
|
+
"@aigne/platform-helpers": "^0.6.3",
|
|
41
|
+
"@aigne/core": "^1.66.0-beta.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/bun": "^1.2.22",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"npm-run-all": "^4.1.5",
|
|
47
47
|
"rimraf": "^6.0.1",
|
|
48
48
|
"typescript": "^5.9.2",
|
|
49
|
-
"@aigne/test-utils": "^0.5.58-beta.
|
|
49
|
+
"@aigne/test-utils": "^0.5.58-beta.5"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"lint": "tsc --noEmit",
|