@aigne/core 1.41.0 → 1.42.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,22 @@
12
12
  * dependencies
13
13
  * @aigne/observability bumped to 0.1.0
14
14
 
15
+ ## [1.42.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.41.0...core-v1.42.0) (2025-08-01)
16
+
17
+
18
+ ### Features
19
+
20
+ * **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))
21
+ * 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))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @aigne/observability-api bumped to 0.9.0
29
+ * @aigne/platform-helpers bumped to 0.5.0
30
+
15
31
  ## [1.41.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.40.0...core-v1.41.0) (2025-07-31)
16
32
 
17
33
 
@@ -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()),
@@ -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>;
@@ -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.42.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",