@aigne/core 1.25.0 → 1.27.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 +21 -0
- package/lib/cjs/loader/index.d.ts +15 -7
- package/lib/cjs/loader/index.js +12 -4
- package/lib/dts/loader/index.d.ts +15 -7
- package/lib/esm/loader/index.d.ts +15 -7
- package/lib/esm/loader/index.js +12 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,27 @@
|
|
|
12
12
|
* dependencies
|
|
13
13
|
* @aigne/observability bumped to 0.1.0
|
|
14
14
|
|
|
15
|
+
## [1.27.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.26.0...core-v1.27.0) (2025-07-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **cli:** support HTTPS_PROXY and named path param ([#196](https://github.com/AIGNE-io/aigne-framework/issues/196)) ([04e684e](https://github.com/AIGNE-io/aigne-framework/commit/04e684ee26bc2d79924b0e3cb541cd07a7191804))
|
|
21
|
+
|
|
22
|
+
## [1.26.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.25.0...core-v1.26.0) (2025-06-30)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **ux:** polish tracing ux and update docs ([#193](https://github.com/AIGNE-io/aigne-framework/issues/193)) ([f80b63e](https://github.com/AIGNE-io/aigne-framework/commit/f80b63ecb1cfb00daa9b68330026da839d33f8a2))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* The following workspace dependencies were updated
|
|
33
|
+
* dependencies
|
|
34
|
+
* @aigne/observability bumped to 0.3.0
|
|
35
|
+
|
|
15
36
|
## [1.25.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.24.1...core-v1.25.0) (2025-06-29)
|
|
16
37
|
|
|
17
38
|
|
|
@@ -3,13 +3,21 @@ import { z } from "zod";
|
|
|
3
3
|
import { Agent } from "../agents/agent.js";
|
|
4
4
|
import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
|
|
5
5
|
import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
|
|
6
|
+
interface LoadableModelClass {
|
|
7
|
+
new (parameters: {
|
|
8
|
+
model?: string;
|
|
9
|
+
modelOptions?: ChatModelOptions;
|
|
10
|
+
}): ChatModel;
|
|
11
|
+
}
|
|
12
|
+
export interface LoadableModel {
|
|
13
|
+
name: string;
|
|
14
|
+
create: (options: {
|
|
15
|
+
model?: string;
|
|
16
|
+
modelOptions?: ChatModelOptions;
|
|
17
|
+
}) => ChatModel;
|
|
18
|
+
}
|
|
6
19
|
export interface LoadOptions {
|
|
7
|
-
models:
|
|
8
|
-
new (parameters: {
|
|
9
|
-
model?: string;
|
|
10
|
-
modelOptions?: ChatModelOptions;
|
|
11
|
-
}): ChatModel;
|
|
12
|
-
}[];
|
|
20
|
+
models: (LoadableModel | LoadableModelClass)[];
|
|
13
21
|
memories?: {
|
|
14
22
|
new (parameters?: MemoryAgentOptions): MemoryAgent;
|
|
15
23
|
}[];
|
|
@@ -31,7 +39,7 @@ export declare function load(options: LoadOptions): Promise<{
|
|
|
31
39
|
} | null | undefined;
|
|
32
40
|
}>;
|
|
33
41
|
export declare function loadAgent(path: string, options?: LoadOptions): Promise<Agent>;
|
|
34
|
-
export declare function loadModel(models:
|
|
42
|
+
export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["chat_model"]>, modelOptions?: ChatModelOptions): Promise<ChatModel | undefined>;
|
|
35
43
|
declare const aigneFileSchema: z.ZodObject<{
|
|
36
44
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
45
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/lib/cjs/loader/index.js
CHANGED
|
@@ -23,7 +23,12 @@ async function load(options) {
|
|
|
23
23
|
const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(index_js_1.nodejs.path.join(rootDir, filename), options)));
|
|
24
24
|
return {
|
|
25
25
|
...aigne,
|
|
26
|
-
model: await loadModel(options.models
|
|
26
|
+
model: await loadModel(options.models.map((i) => typeof i === "function"
|
|
27
|
+
? {
|
|
28
|
+
name: i.name,
|
|
29
|
+
create: (options) => new i(options),
|
|
30
|
+
}
|
|
31
|
+
: i), aigne.chat_model),
|
|
27
32
|
agents,
|
|
28
33
|
skills,
|
|
29
34
|
};
|
|
@@ -91,12 +96,15 @@ async function loadModel(models, model, modelOptions) {
|
|
|
91
96
|
frequencyPenalty: model?.frequencyPenalty ?? undefined,
|
|
92
97
|
presencePenalty: model?.presencePenalty ?? undefined,
|
|
93
98
|
};
|
|
94
|
-
const
|
|
99
|
+
const m = models.find((m) => m.name
|
|
95
100
|
.toLowerCase()
|
|
96
101
|
.includes((MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER).toLowerCase()));
|
|
97
|
-
if (!
|
|
102
|
+
if (!m)
|
|
98
103
|
throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
|
|
99
|
-
return
|
|
104
|
+
return m.create({
|
|
105
|
+
model: params.model,
|
|
106
|
+
modelOptions: { ...params, ...modelOptions },
|
|
107
|
+
});
|
|
100
108
|
}
|
|
101
109
|
const aigneFileSchema = zod_1.z.object({
|
|
102
110
|
name: zod_1.z.string().nullish(),
|
|
@@ -3,13 +3,21 @@ import { z } from "zod";
|
|
|
3
3
|
import { Agent } from "../agents/agent.js";
|
|
4
4
|
import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
|
|
5
5
|
import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
|
|
6
|
+
interface LoadableModelClass {
|
|
7
|
+
new (parameters: {
|
|
8
|
+
model?: string;
|
|
9
|
+
modelOptions?: ChatModelOptions;
|
|
10
|
+
}): ChatModel;
|
|
11
|
+
}
|
|
12
|
+
export interface LoadableModel {
|
|
13
|
+
name: string;
|
|
14
|
+
create: (options: {
|
|
15
|
+
model?: string;
|
|
16
|
+
modelOptions?: ChatModelOptions;
|
|
17
|
+
}) => ChatModel;
|
|
18
|
+
}
|
|
6
19
|
export interface LoadOptions {
|
|
7
|
-
models:
|
|
8
|
-
new (parameters: {
|
|
9
|
-
model?: string;
|
|
10
|
-
modelOptions?: ChatModelOptions;
|
|
11
|
-
}): ChatModel;
|
|
12
|
-
}[];
|
|
20
|
+
models: (LoadableModel | LoadableModelClass)[];
|
|
13
21
|
memories?: {
|
|
14
22
|
new (parameters?: MemoryAgentOptions): MemoryAgent;
|
|
15
23
|
}[];
|
|
@@ -31,7 +39,7 @@ export declare function load(options: LoadOptions): Promise<{
|
|
|
31
39
|
} | null | undefined;
|
|
32
40
|
}>;
|
|
33
41
|
export declare function loadAgent(path: string, options?: LoadOptions): Promise<Agent>;
|
|
34
|
-
export declare function loadModel(models:
|
|
42
|
+
export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["chat_model"]>, modelOptions?: ChatModelOptions): Promise<ChatModel | undefined>;
|
|
35
43
|
declare const aigneFileSchema: z.ZodObject<{
|
|
36
44
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
45
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -3,13 +3,21 @@ import { z } from "zod";
|
|
|
3
3
|
import { Agent } from "../agents/agent.js";
|
|
4
4
|
import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
|
|
5
5
|
import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
|
|
6
|
+
interface LoadableModelClass {
|
|
7
|
+
new (parameters: {
|
|
8
|
+
model?: string;
|
|
9
|
+
modelOptions?: ChatModelOptions;
|
|
10
|
+
}): ChatModel;
|
|
11
|
+
}
|
|
12
|
+
export interface LoadableModel {
|
|
13
|
+
name: string;
|
|
14
|
+
create: (options: {
|
|
15
|
+
model?: string;
|
|
16
|
+
modelOptions?: ChatModelOptions;
|
|
17
|
+
}) => ChatModel;
|
|
18
|
+
}
|
|
6
19
|
export interface LoadOptions {
|
|
7
|
-
models:
|
|
8
|
-
new (parameters: {
|
|
9
|
-
model?: string;
|
|
10
|
-
modelOptions?: ChatModelOptions;
|
|
11
|
-
}): ChatModel;
|
|
12
|
-
}[];
|
|
20
|
+
models: (LoadableModel | LoadableModelClass)[];
|
|
13
21
|
memories?: {
|
|
14
22
|
new (parameters?: MemoryAgentOptions): MemoryAgent;
|
|
15
23
|
}[];
|
|
@@ -31,7 +39,7 @@ export declare function load(options: LoadOptions): Promise<{
|
|
|
31
39
|
} | null | undefined;
|
|
32
40
|
}>;
|
|
33
41
|
export declare function loadAgent(path: string, options?: LoadOptions): Promise<Agent>;
|
|
34
|
-
export declare function loadModel(models:
|
|
42
|
+
export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["chat_model"]>, modelOptions?: ChatModelOptions): Promise<ChatModel | undefined>;
|
|
35
43
|
declare const aigneFileSchema: z.ZodObject<{
|
|
36
44
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
45
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/lib/esm/loader/index.js
CHANGED
|
@@ -17,7 +17,12 @@ export async function load(options) {
|
|
|
17
17
|
const skills = await Promise.all((aigne.skills ?? []).map((filename) => loadAgent(nodejs.path.join(rootDir, filename), options)));
|
|
18
18
|
return {
|
|
19
19
|
...aigne,
|
|
20
|
-
model: await loadModel(options.models
|
|
20
|
+
model: await loadModel(options.models.map((i) => typeof i === "function"
|
|
21
|
+
? {
|
|
22
|
+
name: i.name,
|
|
23
|
+
create: (options) => new i(options),
|
|
24
|
+
}
|
|
25
|
+
: i), aigne.chat_model),
|
|
21
26
|
agents,
|
|
22
27
|
skills,
|
|
23
28
|
};
|
|
@@ -85,12 +90,15 @@ export async function loadModel(models, model, modelOptions) {
|
|
|
85
90
|
frequencyPenalty: model?.frequencyPenalty ?? undefined,
|
|
86
91
|
presencePenalty: model?.presencePenalty ?? undefined,
|
|
87
92
|
};
|
|
88
|
-
const
|
|
93
|
+
const m = models.find((m) => m.name
|
|
89
94
|
.toLowerCase()
|
|
90
95
|
.includes((MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER).toLowerCase()));
|
|
91
|
-
if (!
|
|
96
|
+
if (!m)
|
|
92
97
|
throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
|
|
93
|
-
return
|
|
98
|
+
return m.create({
|
|
99
|
+
model: params.model,
|
|
100
|
+
modelOptions: { ...params, ...modelOptions },
|
|
101
|
+
});
|
|
94
102
|
}
|
|
95
103
|
const aigneFileSchema = z.object({
|
|
96
104
|
name: z.string().nullish(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "AIGNE core library for building AI-powered applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"zod": "^3.24.4",
|
|
83
83
|
"zod-to-json-schema": "^3.24.5",
|
|
84
84
|
"@aigne/platform-helpers": "^0.1.2",
|
|
85
|
-
"@aigne/observability": "^0.
|
|
85
|
+
"@aigne/observability": "^0.3.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/bun": "^1.2.12",
|