@aigne/core 0.4.199 → 0.4.201-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/lib/cjs/function-agent.js +10 -14
- package/lib/cjs/llm-agent.js +15 -15
- package/lib/cjs/llm-decision-agent.js +3 -4
- package/lib/cjs/local-function-agent.js +6 -8
- package/lib/cjs/pipeline-agent.js +9 -12
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/function-agent.js +11 -15
- package/lib/esm/llm-agent.js +15 -15
- package/lib/esm/llm-decision-agent.js +3 -4
- package/lib/esm/local-function-agent.js +6 -8
- package/lib/esm/pipeline-agent.js +9 -12
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/data-type.d.ts +7 -0
- package/lib/types/function-agent.d.ts +14 -13
- package/lib/types/llm-agent.d.ts +14 -6
- package/lib/types/llm-decision-agent.d.ts +11 -8
- package/lib/types/local-function-agent.d.ts +17 -16
- package/lib/types/pipeline-agent.d.ts +20 -15
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/types/data-type.d.ts
CHANGED
|
@@ -30,3 +30,10 @@ export interface DataTypeArray extends DataTypeBase {
|
|
|
30
30
|
defaultValue?: object[];
|
|
31
31
|
items?: OmitPropsFromUnion<DataType, 'id'>;
|
|
32
32
|
}
|
|
33
|
+
type SchemaTypeInner<T extends Record<string, OmitPropsFromUnion<DataType, 'id' | 'name'>>> = {
|
|
34
|
+
[K in keyof T]: T[K]['type'] extends 'string' ? string : T[K]['type'] extends 'number' ? number : T[K]['type'] extends 'boolean' ? boolean : T[K]['type'] extends 'object' ? object : T[K]['type'] extends 'array' ? object[] : never;
|
|
35
|
+
};
|
|
36
|
+
export type SchemaType<T extends Record<string, OmitPropsFromUnion<DataType, 'id' | 'name'>>> = {
|
|
37
|
+
[K in keyof T]: T[K]['required'] extends true ? SchemaTypeInner<T>[K] : SchemaTypeInner<T>[K] | undefined;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { DataType } from './data-type';
|
|
1
|
+
import { DataType, SchemaType } from './data-type';
|
|
2
2
|
import { FunctionRunner } from './function-runner';
|
|
3
3
|
import { RunOptions, Runnable, RunnableDefinition, RunnableResponseStream } from './runnable';
|
|
4
|
+
import { OmitPropsFromUnion } from './utils/omit';
|
|
4
5
|
export declare class FunctionAgent<I extends {} = {}, O extends {} = {}> extends Runnable<I, O> {
|
|
5
6
|
definition: FunctionAgentDefinition;
|
|
6
7
|
runner?: FunctionRunner | undefined;
|
|
7
|
-
static create<I extends {
|
|
8
|
+
static create<I extends {
|
|
9
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
10
|
+
}, O extends {
|
|
11
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
12
|
+
}>(options: Parameters<typeof createFunctionAgentDefinition<I, O>>[0]): FunctionAgent<SchemaType<I>, SchemaType<O>>;
|
|
8
13
|
constructor(definition: FunctionAgentDefinition, runner?: FunctionRunner | undefined);
|
|
9
14
|
run(input: I, options: RunOptions & {
|
|
10
15
|
stream: true;
|
|
@@ -13,19 +18,15 @@ export declare class FunctionAgent<I extends {} = {}, O extends {} = {}> extends
|
|
|
13
18
|
stream?: false;
|
|
14
19
|
}): Promise<O>;
|
|
15
20
|
}
|
|
16
|
-
export declare function createFunctionAgentDefinition
|
|
21
|
+
export declare function createFunctionAgentDefinition<I extends {
|
|
22
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
23
|
+
}, O extends {
|
|
24
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
25
|
+
}>(options: {
|
|
17
26
|
id?: string;
|
|
18
27
|
name?: string;
|
|
19
|
-
inputs
|
|
20
|
-
|
|
21
|
-
type: DataType['type'];
|
|
22
|
-
required?: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
outputs?: {
|
|
25
|
-
name: string;
|
|
26
|
-
type: DataType['type'];
|
|
27
|
-
required?: boolean;
|
|
28
|
-
}[];
|
|
28
|
+
inputs: I;
|
|
29
|
+
outputs: O;
|
|
29
30
|
language: string;
|
|
30
31
|
code: string;
|
|
31
32
|
}): FunctionAgentDefinition;
|
package/lib/types/llm-agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataType } from './data-type';
|
|
1
|
+
import { DataType, SchemaType } from './data-type';
|
|
2
2
|
import { LLMModel, LLMModelInputs, Role } from './llm-model';
|
|
3
3
|
import { RunOptions, Runnable, RunnableDefinition, RunnableResponseStream } from './runnable';
|
|
4
4
|
import { OmitPropsFromUnion } from './utils/omit';
|
|
@@ -6,7 +6,11 @@ import { OrderedRecord } from './utils/ordered-map';
|
|
|
6
6
|
export declare class LLMAgent<I extends {} = {}, O extends {} = {}> extends Runnable<I, O> {
|
|
7
7
|
definition: LLMAgentDefinition;
|
|
8
8
|
model?: LLMModel | undefined;
|
|
9
|
-
static create<I extends {
|
|
9
|
+
static create<I extends {
|
|
10
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
11
|
+
}, O extends {
|
|
12
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
13
|
+
}>(options: Parameters<typeof createLLMAgentDefinition<I, O>>[0]): LLMAgent<SchemaType<I>, SchemaType<O>>;
|
|
10
14
|
constructor(definition: LLMAgentDefinition, model?: LLMModel | undefined);
|
|
11
15
|
run(input: I, options: RunOptions & {
|
|
12
16
|
stream: true;
|
|
@@ -15,16 +19,20 @@ export declare class LLMAgent<I extends {} = {}, O extends {} = {}> extends Runn
|
|
|
15
19
|
stream?: false;
|
|
16
20
|
}): Promise<O>;
|
|
17
21
|
}
|
|
18
|
-
export declare function createLLMAgentDefinition
|
|
22
|
+
export declare function createLLMAgentDefinition<I extends {
|
|
23
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
24
|
+
}, O extends {
|
|
25
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
26
|
+
}>(options: {
|
|
19
27
|
id?: string;
|
|
20
28
|
name?: string;
|
|
29
|
+
inputs: I;
|
|
30
|
+
outputs: O;
|
|
31
|
+
modelOptions?: LLMModelInputs['modelOptions'];
|
|
21
32
|
messages?: {
|
|
22
33
|
role: Role;
|
|
23
34
|
content: string;
|
|
24
35
|
}[];
|
|
25
|
-
modelOptions?: LLMModelInputs['modelOptions'];
|
|
26
|
-
inputs?: OmitPropsFromUnion<DataType, 'id'>[];
|
|
27
|
-
outputs?: OmitPropsFromUnion<DataType, 'id'>[];
|
|
28
36
|
}): LLMAgentDefinition;
|
|
29
37
|
export interface LLMAgentDefinition extends RunnableDefinition {
|
|
30
38
|
type: 'llm_agent';
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Context } from './context';
|
|
2
|
-
import { DataType } from './data-type';
|
|
2
|
+
import { DataType, SchemaType } from './data-type';
|
|
3
3
|
import { LLMModel, LLMModelInputMessage, LLMModelInputs, LLMModelOptions } from './llm-model';
|
|
4
4
|
import { RunOptions, Runnable, RunnableDefinition, RunnableResponseStream } from './runnable';
|
|
5
5
|
import { OrderedRecord } from './utils';
|
|
6
|
+
import { OmitPropsFromUnion } from './utils/omit';
|
|
6
7
|
export declare class LLMDecisionAgent<I extends {
|
|
7
8
|
[key: string]: any;
|
|
8
9
|
} = {}, O extends {} = {}> extends Runnable<I, O> {
|
|
9
10
|
definition: LLMDecisionAgentDefinition;
|
|
10
11
|
model?: LLMModel | undefined;
|
|
11
12
|
context?: Context | undefined;
|
|
12
|
-
static create<I extends {
|
|
13
|
+
static create<I extends {
|
|
14
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
15
|
+
}, O extends {
|
|
16
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
17
|
+
}>(options: Parameters<typeof createLLMDecisionAgentDefinition<I>>[0]): LLMDecisionAgent<SchemaType<I>, SchemaType<O>>;
|
|
13
18
|
constructor(definition: LLMDecisionAgentDefinition, model?: LLMModel | undefined, context?: Context | undefined);
|
|
14
19
|
run(input: I, options: RunOptions & {
|
|
15
20
|
stream: true;
|
|
@@ -29,14 +34,12 @@ export interface DecisionAgentCaseParameter<I extends {} = {}, O extends {} = {}
|
|
|
29
34
|
} | undefined;
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
|
-
export declare function createLLMDecisionAgentDefinition
|
|
37
|
+
export declare function createLLMDecisionAgentDefinition<I extends {
|
|
38
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
39
|
+
}>(options: {
|
|
33
40
|
id?: string;
|
|
34
41
|
name?: string;
|
|
35
|
-
inputs
|
|
36
|
-
name: string;
|
|
37
|
-
type: DataType['type'];
|
|
38
|
-
required?: boolean;
|
|
39
|
-
}[];
|
|
42
|
+
inputs: I;
|
|
40
43
|
messages: string;
|
|
41
44
|
modelOptions?: LLMModelOptions;
|
|
42
45
|
cases: DecisionAgentCaseParameter[];
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Context } from './context';
|
|
2
|
-
import { DataType } from './data-type';
|
|
2
|
+
import { DataType, SchemaType } from './data-type';
|
|
3
3
|
import { RunOptions, Runnable, RunnableDefinition, RunnableResponse, RunnableResponseStream } from './runnable';
|
|
4
|
+
import { OmitPropsFromUnion } from './utils/omit';
|
|
4
5
|
export declare class LocalFunctionAgent<I extends {} = {}, O extends {} = {}, State = {}> extends Runnable<I, O> {
|
|
5
6
|
definition: LocalFunctionAgentDefinition<I, O, State>;
|
|
6
7
|
context?: Context<State> | undefined;
|
|
7
|
-
static create<I extends {
|
|
8
|
+
static create<I extends {
|
|
9
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
10
|
+
}, O extends {
|
|
11
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
12
|
+
}, State = {}>(options: Parameters<typeof createLocalFunctionAgentDefinition<I, O, State>>[0]): LocalFunctionAgent<SchemaType<I>, SchemaType<O>, State>;
|
|
8
13
|
constructor(definition: LocalFunctionAgentDefinition<I, O, State>, context?: Context<State> | undefined);
|
|
9
14
|
run(input: I, options: RunOptions & {
|
|
10
15
|
stream: true;
|
|
@@ -13,23 +18,19 @@ export declare class LocalFunctionAgent<I extends {} = {}, O extends {} = {}, St
|
|
|
13
18
|
stream?: false;
|
|
14
19
|
}): Promise<O>;
|
|
15
20
|
}
|
|
16
|
-
export declare function createLocalFunctionAgentDefinition<I extends {
|
|
21
|
+
export declare function createLocalFunctionAgentDefinition<I extends {
|
|
22
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
23
|
+
}, O extends {
|
|
24
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
25
|
+
}, State = {}>(options: {
|
|
17
26
|
id?: string;
|
|
18
27
|
name?: string;
|
|
19
|
-
inputs
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
required?: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
outputs?: {
|
|
25
|
-
name: string;
|
|
26
|
-
type: DataType['type'];
|
|
27
|
-
required?: boolean;
|
|
28
|
-
}[];
|
|
29
|
-
function?: (input: I, options: {
|
|
28
|
+
inputs: I;
|
|
29
|
+
outputs: O;
|
|
30
|
+
function?: (input: SchemaType<I>, options: {
|
|
30
31
|
context: Context<State>;
|
|
31
|
-
}) => Promise<RunnableResponse<O
|
|
32
|
-
}): LocalFunctionAgentDefinition<I
|
|
32
|
+
}) => Promise<RunnableResponse<SchemaType<O>>>;
|
|
33
|
+
}): LocalFunctionAgentDefinition<SchemaType<I>, SchemaType<O>, State>;
|
|
33
34
|
export interface LocalFunctionAgentDefinition<I extends {} = {}, O extends {} = {}, State = {}> extends RunnableDefinition {
|
|
34
35
|
type: 'local_function_agent';
|
|
35
36
|
function?: (input: I, options: {
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { Context } from './context';
|
|
2
|
-
import { DataType } from './data-type';
|
|
2
|
+
import { DataType, SchemaType } from './data-type';
|
|
3
3
|
import { RunOptions, Runnable, RunnableDefinition, RunnableOutput, RunnableResponseStream } from './runnable';
|
|
4
|
+
import { OmitPropsFromUnion } from './utils/omit';
|
|
4
5
|
import { OrderedRecord } from './utils/ordered-map';
|
|
5
6
|
export declare class PipelineAgent<I extends {
|
|
6
7
|
[key: string]: any;
|
|
7
8
|
} = {}, O extends {} = {}> extends Runnable<I, O> {
|
|
8
9
|
definition: PipelineAgentDefinition;
|
|
9
10
|
context?: Context | undefined;
|
|
10
|
-
static create<I extends {
|
|
11
|
+
static create<I extends {
|
|
12
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
13
|
+
}, O extends {
|
|
14
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'> & {
|
|
15
|
+
fromVariable: string;
|
|
16
|
+
fromVariablePropPath?: string[];
|
|
17
|
+
};
|
|
18
|
+
}>(options: Parameters<typeof createPipelineAgentDefinition<I, O>>[0]): PipelineAgent<SchemaType<I>, SchemaType<O>>;
|
|
11
19
|
constructor(definition: PipelineAgentDefinition, context?: Context | undefined);
|
|
12
20
|
run(input: I, options: RunOptions & {
|
|
13
21
|
stream: true;
|
|
@@ -26,21 +34,18 @@ export interface PipelineAgentProcessParameter<I extends {} = {}, O extends {} =
|
|
|
26
34
|
} | undefined;
|
|
27
35
|
};
|
|
28
36
|
}
|
|
29
|
-
export declare function createPipelineAgentDefinition
|
|
30
|
-
id
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
name: string;
|
|
34
|
-
type: DataType['type'];
|
|
35
|
-
required?: boolean;
|
|
36
|
-
}[];
|
|
37
|
-
outputs: {
|
|
38
|
-
name: string;
|
|
39
|
-
type: DataType['type'];
|
|
40
|
-
required?: boolean;
|
|
37
|
+
export declare function createPipelineAgentDefinition<I extends {
|
|
38
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'>;
|
|
39
|
+
}, O extends {
|
|
40
|
+
[name: string]: OmitPropsFromUnion<DataType, 'id' | 'name'> & {
|
|
41
41
|
fromVariable: string;
|
|
42
42
|
fromVariablePropPath?: string[];
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
|
+
}>(options: {
|
|
45
|
+
id?: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
inputs: I;
|
|
48
|
+
outputs: O;
|
|
44
49
|
processes?: PipelineAgentProcessParameter[];
|
|
45
50
|
}): PipelineAgentDefinition;
|
|
46
51
|
export interface PipelineAgentDefinition extends RunnableDefinition {
|