@aigne/core 1.41.0 → 1.43.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 CHANGED
@@ -12,6 +12,34 @@
12
12
  * dependencies
13
13
  * @aigne/observability bumped to 0.1.0
14
14
 
15
+ ## [1.43.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.42.0...core-v1.43.0) (2025-08-04)
16
+
17
+
18
+ ### Features
19
+
20
+ * add includeAllStepsOutput option to control TeamAgent sequential streaming behavior ([#305](https://github.com/AIGNE-io/aigne-framework/issues/305)) ([0817475](https://github.com/AIGNE-io/aigne-framework/commit/08174751316b940a70463e71971a19a18b92667b))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **core:** share skills/agents from context ([#309](https://github.com/AIGNE-io/aigne-framework/issues/309)) ([88dd849](https://github.com/AIGNE-io/aigne-framework/commit/88dd849954c6f3fb68df238be22be3371c734e6e))
26
+
27
+ ## [1.42.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.41.0...core-v1.42.0) (2025-08-01)
28
+
29
+
30
+ ### Features
31
+
32
+ * **cli:** add `--model` option for aigne applications ([#302](https://github.com/AIGNE-io/aigne-framework/issues/302)) ([5d63743](https://github.com/AIGNE-io/aigne-framework/commit/5d63743b8a47be64fd49245983f4f2f9da3197a0))
33
+ * support google model and skip check mode when connected to Hub ([#300](https://github.com/AIGNE-io/aigne-framework/issues/300)) ([e992c0f](https://github.com/AIGNE-io/aigne-framework/commit/e992c0f3335a7c512fa807d5b8ad10c9c3bf2351))
34
+
35
+
36
+ ### Dependencies
37
+
38
+ * The following workspace dependencies were updated
39
+ * dependencies
40
+ * @aigne/observability-api bumped to 0.9.0
41
+ * @aigne/platform-helpers bumped to 0.5.0
42
+
15
43
  ## [1.41.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.40.0...core-v1.41.0) (2025-07-31)
16
44
 
17
45
 
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
156
156
  * @default false
157
157
  */
158
158
  iterateWithPreviousOutput?: boolean;
159
+ /**
160
+ * Controls whether to include output from all intermediate steps in sequential processing.
161
+ *
162
+ * @see TeamAgent.includeAllStepsOutput for detailed documentation
163
+ * @default false
164
+ */
165
+ includeAllStepsOutput?: boolean;
159
166
  }
160
167
  /**
161
168
  * TeamAgent coordinates a group of agents working together to accomplish tasks.
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
230
237
  * @default false
231
238
  */
232
239
  iterateWithPreviousOutput?: boolean;
240
+ /**
241
+ * Controls whether to include output from all intermediate steps in sequential processing.
242
+ *
243
+ * When `true`, yields output chunks from every agent in the sequential chain.
244
+ * When `false`, only yields output from the final agent.
245
+ *
246
+ * Only affects sequential processing mode. Useful for debugging and monitoring
247
+ * multi-step agent workflows.
248
+ *
249
+ * @default false
250
+ */
251
+ includeAllStepsOutput?: boolean;
233
252
  /**
234
253
  * Process an input message by routing it through the team's agents.
235
254
  *
@@ -83,6 +83,7 @@ class TeamAgent extends agent_js_1.Agent {
83
83
  };
84
84
  this.iterateOn = options.iterateOn;
85
85
  this.iterateWithPreviousOutput = options.iterateWithPreviousOutput;
86
+ this.includeAllStepsOutput = options.includeAllStepsOutput;
86
87
  }
87
88
  /**
88
89
  * The processing mode that determines how agents in the team are executed.
@@ -117,6 +118,18 @@ class TeamAgent extends agent_js_1.Agent {
117
118
  * @default false
118
119
  */
119
120
  iterateWithPreviousOutput;
121
+ /**
122
+ * Controls whether to include output from all intermediate steps in sequential processing.
123
+ *
124
+ * When `true`, yields output chunks from every agent in the sequential chain.
125
+ * When `false`, only yields output from the final agent.
126
+ *
127
+ * Only affects sequential processing mode. Useful for debugging and monitoring
128
+ * multi-step agent workflows.
129
+ *
130
+ * @default false
131
+ */
132
+ includeAllStepsOutput;
120
133
  /**
121
134
  * Process an input message by routing it through the team's agents.
122
135
  *
@@ -212,8 +225,12 @@ class TeamAgent extends agent_js_1.Agent {
212
225
  const output = {};
213
226
  for (const agent of this.skills) {
214
227
  const o = await options.context.invoke(agent, { ...input, ...output }, { ...options, streaming: true });
228
+ const isLast = agent === this.skills[this.skills.length - 1];
215
229
  for await (const chunk of o) {
216
- yield chunk;
230
+ // Only yield the chunk if it is the last agent in the sequence
231
+ if (this.includeAllStepsOutput || isLast) {
232
+ yield chunk;
233
+ }
217
234
  (0, stream_utils_js_1.mergeAgentResponseChunk)(output, chunk);
218
235
  }
219
236
  }
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
73
73
  rootId: string;
74
74
  model?: ChatModel;
75
75
  skills?: Agent[];
76
+ agents: Agent[];
76
77
  observer?: AIGNEObserver;
77
78
  span?: Span;
78
79
  usage: ContextUsage;
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
153
154
  get messageQueue(): MessageQueue;
154
155
  get model(): ChatModel | undefined;
155
156
  get skills(): Agent<any, any>[] | undefined;
157
+ get agents(): Agent<any, any>[];
156
158
  get observer(): AIGNEObserver | undefined;
157
159
  get limits(): ContextLimits | undefined;
158
160
  get status(): "normal" | "timeout";
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
180
182
  declare class AIGNEContextShared {
181
183
  private readonly parent?;
182
184
  spans: Span[];
183
- constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
185
+ constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
184
186
  messageQueue?: MessageQueue;
185
187
  events?: Emitter<any>;
186
188
  }) | undefined);
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
188
190
  readonly events: Emitter<any>;
189
191
  get model(): ChatModel | undefined;
190
192
  get skills(): Agent<any, any>[] | undefined;
193
+ get agents(): Agent<any, any>[];
191
194
  get observer(): AIGNEObserver | undefined;
192
195
  get limits(): ContextLimits | undefined;
193
196
  addSpan(span: Span): void;
@@ -64,6 +64,9 @@ class AIGNEContext {
64
64
  get skills() {
65
65
  return this.internal.skills;
66
66
  }
67
+ get agents() {
68
+ return this.internal.agents;
69
+ }
67
70
  get observer() {
68
71
  return this.internal.observer;
69
72
  }
@@ -300,6 +303,9 @@ class AIGNEContextShared {
300
303
  get skills() {
301
304
  return this.parent?.skills;
302
305
  }
306
+ get agents() {
307
+ return this.parent?.agents ?? [];
308
+ }
303
309
  get observer() {
304
310
  return this.parent?.observer;
305
311
  }
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.load = load;
4
4
  exports.loadAgent = loadAgent;
5
- exports.loadModel = loadModel;
6
5
  exports.loadAIGNEFile = loadAIGNEFile;
7
6
  const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
8
7
  const yaml_1 = require("yaml");
@@ -26,12 +25,7 @@ async function load(options) {
26
25
  return {
27
26
  ...aigne,
28
27
  rootDir,
29
- model: await loadModel(options.models.map((i) => typeof i === "function"
30
- ? {
31
- name: i.name,
32
- create: (options) => new i(options),
33
- }
34
- : i), aigne.model),
28
+ model: await options.loadModel(aigne.model),
35
29
  agents: pickAgents(aigne.agents ?? []),
36
30
  skills: pickAgents(aigne.skills ?? []),
37
31
  mcpServer: {
@@ -158,27 +152,6 @@ async function loadMemory(memories, provider, options) {
158
152
  throw new Error(`Unsupported memory: ${provider}`);
159
153
  return new M(options);
160
154
  }
161
- const { MODEL_PROVIDER, MODEL_NAME } = index_js_1.nodejs.env;
162
- const DEFAULT_MODEL_PROVIDER = "openai";
163
- async function loadModel(models, model, modelOptions, accessKeyOptions) {
164
- const params = {
165
- model: MODEL_NAME ?? model?.name ?? undefined,
166
- temperature: model?.temperature ?? undefined,
167
- topP: model?.topP ?? undefined,
168
- frequencyPenalty: model?.frequencyPenalty ?? undefined,
169
- presencePenalty: model?.presencePenalty ?? undefined,
170
- };
171
- const providerName = MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER;
172
- const provider = providerName.replace(/-/g, "");
173
- const m = models.find((m) => m.name.toLowerCase().includes(provider.toLowerCase()));
174
- if (!m)
175
- throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
176
- return m.create({
177
- ...(accessKeyOptions || {}),
178
- model: params.model,
179
- modelOptions: { ...params, ...modelOptions },
180
- });
181
- }
182
155
  const aigneFileSchema = (0, schema_js_1.camelizeSchema)(zod_1.z.object({
183
156
  name: (0, schema_js_1.optionalize)(zod_1.z.string()),
184
157
  description: (0, schema_js_1.optionalize)(zod_1.z.string()),
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
156
156
  * @default false
157
157
  */
158
158
  iterateWithPreviousOutput?: boolean;
159
+ /**
160
+ * Controls whether to include output from all intermediate steps in sequential processing.
161
+ *
162
+ * @see TeamAgent.includeAllStepsOutput for detailed documentation
163
+ * @default false
164
+ */
165
+ includeAllStepsOutput?: boolean;
159
166
  }
160
167
  /**
161
168
  * TeamAgent coordinates a group of agents working together to accomplish tasks.
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
230
237
  * @default false
231
238
  */
232
239
  iterateWithPreviousOutput?: boolean;
240
+ /**
241
+ * Controls whether to include output from all intermediate steps in sequential processing.
242
+ *
243
+ * When `true`, yields output chunks from every agent in the sequential chain.
244
+ * When `false`, only yields output from the final agent.
245
+ *
246
+ * Only affects sequential processing mode. Useful for debugging and monitoring
247
+ * multi-step agent workflows.
248
+ *
249
+ * @default false
250
+ */
251
+ includeAllStepsOutput?: boolean;
233
252
  /**
234
253
  * Process an input message by routing it through the team's agents.
235
254
  *
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
73
73
  rootId: string;
74
74
  model?: ChatModel;
75
75
  skills?: Agent[];
76
+ agents: Agent[];
76
77
  observer?: AIGNEObserver;
77
78
  span?: Span;
78
79
  usage: ContextUsage;
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
153
154
  get messageQueue(): MessageQueue;
154
155
  get model(): ChatModel | undefined;
155
156
  get skills(): Agent<any, any>[] | undefined;
157
+ get agents(): Agent<any, any>[];
156
158
  get observer(): AIGNEObserver | undefined;
157
159
  get limits(): ContextLimits | undefined;
158
160
  get status(): "normal" | "timeout";
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
180
182
  declare class AIGNEContextShared {
181
183
  private readonly parent?;
182
184
  spans: Span[];
183
- constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
185
+ constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
184
186
  messageQueue?: MessageQueue;
185
187
  events?: Emitter<any>;
186
188
  }) | undefined);
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
188
190
  readonly events: Emitter<any>;
189
191
  get model(): ChatModel | undefined;
190
192
  get skills(): Agent<any, any>[] | undefined;
193
+ get agents(): Agent<any, any>[];
191
194
  get observer(): AIGNEObserver | undefined;
192
195
  get limits(): ContextLimits | undefined;
193
196
  addSpan(span: Span): void;
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
156
156
  * @default false
157
157
  */
158
158
  iterateWithPreviousOutput?: boolean;
159
+ /**
160
+ * Controls whether to include output from all intermediate steps in sequential processing.
161
+ *
162
+ * @see TeamAgent.includeAllStepsOutput for detailed documentation
163
+ * @default false
164
+ */
165
+ includeAllStepsOutput?: boolean;
159
166
  }
160
167
  /**
161
168
  * TeamAgent coordinates a group of agents working together to accomplish tasks.
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
230
237
  * @default false
231
238
  */
232
239
  iterateWithPreviousOutput?: boolean;
240
+ /**
241
+ * Controls whether to include output from all intermediate steps in sequential processing.
242
+ *
243
+ * When `true`, yields output chunks from every agent in the sequential chain.
244
+ * When `false`, only yields output from the final agent.
245
+ *
246
+ * Only affects sequential processing mode. Useful for debugging and monitoring
247
+ * multi-step agent workflows.
248
+ *
249
+ * @default false
250
+ */
251
+ includeAllStepsOutput?: boolean;
233
252
  /**
234
253
  * Process an input message by routing it through the team's agents.
235
254
  *
@@ -77,6 +77,7 @@ export class TeamAgent extends Agent {
77
77
  };
78
78
  this.iterateOn = options.iterateOn;
79
79
  this.iterateWithPreviousOutput = options.iterateWithPreviousOutput;
80
+ this.includeAllStepsOutput = options.includeAllStepsOutput;
80
81
  }
81
82
  /**
82
83
  * The processing mode that determines how agents in the team are executed.
@@ -111,6 +112,18 @@ export class TeamAgent extends Agent {
111
112
  * @default false
112
113
  */
113
114
  iterateWithPreviousOutput;
115
+ /**
116
+ * Controls whether to include output from all intermediate steps in sequential processing.
117
+ *
118
+ * When `true`, yields output chunks from every agent in the sequential chain.
119
+ * When `false`, only yields output from the final agent.
120
+ *
121
+ * Only affects sequential processing mode. Useful for debugging and monitoring
122
+ * multi-step agent workflows.
123
+ *
124
+ * @default false
125
+ */
126
+ includeAllStepsOutput;
114
127
  /**
115
128
  * Process an input message by routing it through the team's agents.
116
129
  *
@@ -206,8 +219,12 @@ export class TeamAgent extends Agent {
206
219
  const output = {};
207
220
  for (const agent of this.skills) {
208
221
  const o = await options.context.invoke(agent, { ...input, ...output }, { ...options, streaming: true });
222
+ const isLast = agent === this.skills[this.skills.length - 1];
209
223
  for await (const chunk of o) {
210
- yield chunk;
224
+ // Only yield the chunk if it is the last agent in the sequence
225
+ if (this.includeAllStepsOutput || isLast) {
226
+ yield chunk;
227
+ }
211
228
  mergeAgentResponseChunk(output, chunk);
212
229
  }
213
230
  }
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
73
73
  rootId: string;
74
74
  model?: ChatModel;
75
75
  skills?: Agent[];
76
+ agents: Agent[];
76
77
  observer?: AIGNEObserver;
77
78
  span?: Span;
78
79
  usage: ContextUsage;
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
153
154
  get messageQueue(): MessageQueue;
154
155
  get model(): ChatModel | undefined;
155
156
  get skills(): Agent<any, any>[] | undefined;
157
+ get agents(): Agent<any, any>[];
156
158
  get observer(): AIGNEObserver | undefined;
157
159
  get limits(): ContextLimits | undefined;
158
160
  get status(): "normal" | "timeout";
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
180
182
  declare class AIGNEContextShared {
181
183
  private readonly parent?;
182
184
  spans: Span[];
183
- constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
185
+ constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
184
186
  messageQueue?: MessageQueue;
185
187
  events?: Emitter<any>;
186
188
  }) | undefined);
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
188
190
  readonly events: Emitter<any>;
189
191
  get model(): ChatModel | undefined;
190
192
  get skills(): Agent<any, any>[] | undefined;
193
+ get agents(): Agent<any, any>[];
191
194
  get observer(): AIGNEObserver | undefined;
192
195
  get limits(): ContextLimits | undefined;
193
196
  addSpan(span: Span): void;
@@ -58,6 +58,9 @@ export class AIGNEContext {
58
58
  get skills() {
59
59
  return this.internal.skills;
60
60
  }
61
+ get agents() {
62
+ return this.internal.agents;
63
+ }
61
64
  get observer() {
62
65
  return this.internal.observer;
63
66
  }
@@ -293,6 +296,9 @@ class AIGNEContextShared {
293
296
  get skills() {
294
297
  return this.parent?.skills;
295
298
  }
299
+ get agents() {
300
+ return this.parent?.agents ?? [];
301
+ }
296
302
  get observer() {
297
303
  return this.parent?.observer;
298
304
  }
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -20,12 +20,7 @@ export async function load(options) {
20
20
  return {
21
21
  ...aigne,
22
22
  rootDir,
23
- model: await loadModel(options.models.map((i) => typeof i === "function"
24
- ? {
25
- name: i.name,
26
- create: (options) => new i(options),
27
- }
28
- : i), aigne.model),
23
+ model: await options.loadModel(aigne.model),
29
24
  agents: pickAgents(aigne.agents ?? []),
30
25
  skills: pickAgents(aigne.skills ?? []),
31
26
  mcpServer: {
@@ -152,27 +147,6 @@ async function loadMemory(memories, provider, options) {
152
147
  throw new Error(`Unsupported memory: ${provider}`);
153
148
  return new M(options);
154
149
  }
155
- const { MODEL_PROVIDER, MODEL_NAME } = nodejs.env;
156
- const DEFAULT_MODEL_PROVIDER = "openai";
157
- export async function loadModel(models, model, modelOptions, accessKeyOptions) {
158
- const params = {
159
- model: MODEL_NAME ?? model?.name ?? undefined,
160
- temperature: model?.temperature ?? undefined,
161
- topP: model?.topP ?? undefined,
162
- frequencyPenalty: model?.frequencyPenalty ?? undefined,
163
- presencePenalty: model?.presencePenalty ?? undefined,
164
- };
165
- const providerName = MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER;
166
- const provider = providerName.replace(/-/g, "");
167
- const m = models.find((m) => m.name.toLowerCase().includes(provider.toLowerCase()));
168
- if (!m)
169
- throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
170
- return m.create({
171
- ...(accessKeyOptions || {}),
172
- model: params.model,
173
- modelOptions: { ...params, ...modelOptions },
174
- });
175
- }
176
150
  const aigneFileSchema = camelizeSchema(z.object({
177
151
  name: optionalize(z.string()),
178
152
  description: optionalize(z.string()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.41.0",
3
+ "version": "1.43.0",
4
4
  "description": "AIGNE core library for building AI-powered applications",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -86,8 +86,8 @@
86
86
  "yaml": "^2.8.0",
87
87
  "zod": "^3.25.67",
88
88
  "zod-to-json-schema": "^3.24.6",
89
- "@aigne/observability-api": "^0.8.2",
90
- "@aigne/platform-helpers": "^0.4.0"
89
+ "@aigne/observability-api": "^0.9.0",
90
+ "@aigne/platform-helpers": "^0.5.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@types/bun": "^1.2.18",