@aigne/core 0.4.205-1 → 0.4.206
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/agent.js +37 -6
- package/lib/cjs/definitions/data-type-schema.js +2 -2
- package/lib/cjs/definitions/memory.js +2 -2
- package/lib/cjs/function-agent.js +34 -29
- package/lib/cjs/function-runner.js +6 -4
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/llm-agent.js +23 -55
- package/lib/cjs/llm-decision-agent.js +8 -12
- package/lib/cjs/llm-model.js +2 -2
- package/lib/cjs/local-function-agent.js +7 -21
- package/lib/cjs/pipeline-agent.js +29 -32
- package/lib/cjs/runnable.js +1 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/index.js +5 -2
- package/lib/cjs/utils/stream-utils.js +36 -14
- package/lib/esm/agent.js +39 -8
- package/lib/esm/definitions/data-type-schema.js +2 -2
- package/lib/esm/definitions/memory.js +2 -2
- package/lib/esm/function-agent.js +33 -28
- package/lib/esm/function-runner.js +6 -4
- package/lib/esm/index.js +1 -1
- package/lib/esm/llm-agent.js +23 -54
- package/lib/esm/llm-decision-agent.js +8 -11
- package/lib/esm/llm-model.js +2 -2
- package/lib/esm/local-function-agent.js +7 -20
- package/lib/esm/pipeline-agent.js +29 -31
- package/lib/esm/runnable.js +1 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/index.js +5 -2
- package/lib/esm/utils/stream-utils.js +34 -14
- package/lib/types/agent.d.ts +9 -10
- package/lib/types/context.d.ts +2 -0
- package/lib/types/definitions/data-type-schema.d.ts +7 -5
- package/lib/types/{data-type.d.ts → definitions/data-type.d.ts} +2 -2
- package/lib/types/function-agent.d.ts +33 -20
- package/lib/types/function-runner.d.ts +20 -7
- package/lib/types/index.d.ts +1 -1
- package/lib/types/llm-agent.d.ts +27 -30
- package/lib/types/llm-decision-agent.d.ts +15 -22
- package/lib/types/llm-model.d.ts +2 -2
- package/lib/types/local-function-agent.d.ts +31 -34
- package/lib/types/memorable.d.ts +1 -1
- package/lib/types/pipeline-agent.d.ts +40 -33
- package/lib/types/runnable.d.ts +3 -3
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/utils/index.d.ts +5 -2
- package/lib/types/utils/message-utils.d.ts +3 -3
- package/lib/types/utils/stream-utils.d.ts +5 -3
- package/lib/types/utils/union.d.ts +1 -2
- package/package.json +3 -2
- package/lib/cjs/data-type-schema.js +0 -46
- package/lib/cjs/memory.js +0 -32
- package/lib/esm/data-type-schema.js +0 -43
- package/lib/esm/memory.js +0 -27
- package/lib/types/data-type-schema.d.ts +0 -46
- package/lib/types/memory.d.ts +0 -184
- /package/lib/cjs/{data-type.js → definitions/data-type.js} +0 -0
- /package/lib/esm/{data-type.js → definitions/data-type.js} +0 -0
|
@@ -1,51 +1,57 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Agent, AgentProcessOptions } from './agent';
|
|
2
|
+
import type { Context, ContextState } from './context';
|
|
2
3
|
import { DataTypeSchema, SchemaMapType } from './definitions/data-type-schema';
|
|
3
|
-
import {
|
|
4
|
+
import { CreateRunnableMemory } from './definitions/memory';
|
|
5
|
+
import { MemorableSearchOutput, MemoryItemWithScore } from './memorable';
|
|
6
|
+
import { Runnable, RunnableDefinition, RunnableOutput, RunnableResponseDelta } from './runnable';
|
|
7
|
+
import { MakeNullablePropertyOptional } from './utils/nullable';
|
|
4
8
|
import { OrderedRecord } from './utils/ordered-map';
|
|
9
|
+
import { ExtractRunnableInputType } from './utils/runnable-type';
|
|
5
10
|
export declare class PipelineAgent<I extends {
|
|
6
11
|
[key: string]: any;
|
|
7
|
-
} = {}, O extends {
|
|
12
|
+
} = {}, O extends {
|
|
13
|
+
[name: string]: any;
|
|
14
|
+
} = {}, Memories extends {
|
|
15
|
+
[name: string]: MemoryItemWithScore[];
|
|
16
|
+
} = {}, State extends ContextState = ContextState> extends Agent<I, O, Memories, State> {
|
|
8
17
|
definition: PipelineAgentDefinition;
|
|
9
|
-
static create
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[name: string]: DataTypeSchema & {
|
|
13
|
-
fromVariable: string;
|
|
14
|
-
fromVariablePropPath?: string[];
|
|
15
|
-
};
|
|
16
|
-
}>(options: Parameters<typeof createPipelineAgentDefinition<I, O>>[0]): PipelineAgent<SchemaMapType<I>, SchemaMapType<O>>;
|
|
17
|
-
constructor(definition: PipelineAgentDefinition, context?: Context);
|
|
18
|
-
run(input: I, options: RunOptions & {
|
|
19
|
-
stream: true;
|
|
20
|
-
}): Promise<RunnableResponseStream<O>>;
|
|
21
|
-
run(input: I, options?: RunOptions & {
|
|
22
|
-
stream?: false;
|
|
23
|
-
}): Promise<O>;
|
|
18
|
+
static create: typeof create;
|
|
19
|
+
constructor(definition: PipelineAgentDefinition, context?: Context<State>);
|
|
20
|
+
process(input: I, options: AgentProcessOptions<Memories>): Promise<ReadableStream<RunnableResponseDelta<O>>>;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
type VariableWithPropPath = {
|
|
23
|
+
fromVariable: string;
|
|
24
|
+
fromVariablePropPath?: (string | number)[];
|
|
25
|
+
};
|
|
26
|
+
export type PipelineAgentProcessParameter<R extends Runnable = any, RI extends {
|
|
27
|
+
[name: string]: DataTypeSchema;
|
|
28
|
+
} = ExtractRunnableInputType<R>> = {
|
|
27
29
|
runnable: R;
|
|
28
|
-
input
|
|
29
|
-
[key
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export declare function createPipelineAgentDefinition<I extends {
|
|
30
|
+
input: MakeNullablePropertyOptional<{
|
|
31
|
+
[key in keyof RI]: VariableWithPropPath;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
declare function create<I extends {
|
|
36
35
|
[name: string]: DataTypeSchema;
|
|
37
36
|
}, O extends {
|
|
38
37
|
[name: string]: DataTypeSchema & {
|
|
39
38
|
fromVariable: string;
|
|
40
39
|
fromVariablePropPath?: string[];
|
|
41
40
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
41
|
+
}, Memories extends {
|
|
42
|
+
[name: string]: CreateRunnableMemory<I>;
|
|
43
|
+
}, State extends ContextState, Processes extends {
|
|
44
|
+
[name: string]: PipelineAgentProcessParameter;
|
|
45
|
+
}>({ context, ...options }: {
|
|
46
|
+
context: Context<State>;
|
|
44
47
|
name?: string;
|
|
45
48
|
inputs: I;
|
|
46
49
|
outputs: O;
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
memories?: Memories;
|
|
51
|
+
processes: Processes;
|
|
52
|
+
}): PipelineAgent<SchemaMapType<I>, SchemaMapType<O>, {
|
|
53
|
+
[name in keyof Memories]: MemorableSearchOutput<Memories[name]['memory']>;
|
|
54
|
+
}, State>;
|
|
49
55
|
export interface PipelineAgentDefinition extends RunnableDefinition {
|
|
50
56
|
type: 'pipeline_agent';
|
|
51
57
|
processes?: OrderedRecord<PipelineAgentProcess>;
|
|
@@ -66,7 +72,8 @@ export type PipelineAgentProcess = {
|
|
|
66
72
|
[inputId: string]: {
|
|
67
73
|
from: 'variable';
|
|
68
74
|
fromVariableId?: string;
|
|
69
|
-
fromVariablePropPath?: (string | number)[];
|
|
75
|
+
fromVariablePropPath?: (string | number | symbol)[];
|
|
70
76
|
};
|
|
71
77
|
};
|
|
72
78
|
};
|
|
79
|
+
export {};
|
package/lib/types/runnable.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Context, ContextState } from './context';
|
|
2
|
-
import { DataType } from './data-type';
|
|
3
|
-
import { Memorable } from './memorable';
|
|
1
|
+
import type { Context, ContextState } from './context';
|
|
2
|
+
import type { DataType } from './definitions/data-type';
|
|
3
|
+
import type { Memorable } from './memorable';
|
|
4
4
|
import { OrderedRecord } from './utils/ordered-map';
|
|
5
5
|
export interface RunOptions {
|
|
6
6
|
stream?: boolean;
|