@aigne/core 1.0.10 → 1.0.11
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.d.ts +63 -19
- package/lib/cjs/agent.js +57 -16
- package/lib/cjs/context.d.ts +1 -1
- package/lib/cjs/definitions/data-schema.d.ts +61 -0
- package/lib/cjs/definitions/memory.d.ts +18 -5
- package/lib/cjs/definitions/open-api.d.ts +3 -3
- package/lib/cjs/definitions/preload.d.ts +43 -0
- package/lib/cjs/definitions/preload.js +34 -0
- package/lib/cjs/function-agent.d.ts +15 -56
- package/lib/cjs/function-agent.js +9 -6
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/llm-agent.d.ts +17 -60
- package/lib/cjs/llm-agent.js +8 -5
- package/lib/cjs/llm-decision-agent.d.ts +28 -31
- package/lib/cjs/llm-decision-agent.js +2 -2
- package/lib/cjs/llm-model.d.ts +4 -4
- package/lib/cjs/memorable.d.ts +21 -13
- package/lib/cjs/memorable.js +2 -2
- package/lib/cjs/open-api-agent.d.ts +9 -38
- package/lib/cjs/open-api-agent.js +12 -6
- package/lib/cjs/pipeline-agent.d.ts +14 -37
- package/lib/cjs/pipeline-agent.js +10 -10
- package/lib/cjs/runnable.d.ts +7 -24
- package/lib/cjs/sandbox-function-agent.d.ts +10 -38
- package/lib/cjs/sandbox-function-agent.js +9 -5
- package/lib/cjs/sandbox-function-runner.d.ts +8 -17
- package/lib/cjs/sandbox-function-runner.js +1 -0
- package/lib/cjs/utils/index.d.ts +1 -0
- package/lib/cjs/utils/index.js +1 -0
- package/lib/cjs/utils/logger.d.ts +3 -0
- package/lib/cjs/utils/logger.js +17 -0
- package/lib/cjs/utils/message-utils.d.ts +1 -1
- package/lib/cjs/utils/message-utils.js +1 -4
- package/lib/cjs/utils/open-api-parameter.js +3 -6
- package/lib/cjs/utils/runnable-type.d.ts +4 -22
- package/lib/cjs/utils/structured-output-schema.d.ts +2 -2
- package/lib/cjs/utils/type-utils.d.ts +1 -0
- package/lib/cjs/{logger.js → utils/type-utils.js} +0 -2
- package/lib/dts/agent.d.ts +63 -19
- package/lib/dts/context.d.ts +1 -1
- package/lib/dts/definitions/data-schema.d.ts +61 -0
- package/lib/dts/definitions/memory.d.ts +18 -5
- package/lib/dts/definitions/open-api.d.ts +3 -3
- package/lib/dts/definitions/preload.d.ts +43 -0
- package/lib/dts/function-agent.d.ts +15 -56
- package/lib/dts/index.d.ts +1 -1
- package/lib/dts/llm-agent.d.ts +17 -60
- package/lib/dts/llm-decision-agent.d.ts +28 -31
- package/lib/dts/llm-model.d.ts +4 -4
- package/lib/dts/memorable.d.ts +21 -13
- package/lib/dts/open-api-agent.d.ts +9 -38
- package/lib/dts/pipeline-agent.d.ts +14 -37
- package/lib/dts/runnable.d.ts +7 -24
- package/lib/dts/sandbox-function-agent.d.ts +10 -38
- package/lib/dts/sandbox-function-runner.d.ts +8 -17
- package/lib/dts/utils/index.d.ts +1 -0
- package/lib/dts/utils/logger.d.ts +3 -0
- package/lib/dts/utils/message-utils.d.ts +1 -1
- package/lib/dts/utils/runnable-type.d.ts +4 -22
- package/lib/dts/utils/structured-output-schema.d.ts +2 -2
- package/lib/dts/utils/type-utils.d.ts +1 -0
- package/lib/esm/agent.d.ts +63 -19
- package/lib/esm/agent.js +53 -9
- package/lib/esm/context.d.ts +1 -1
- package/lib/esm/definitions/data-schema.d.ts +61 -0
- package/lib/esm/definitions/memory.d.ts +18 -5
- package/lib/esm/definitions/open-api.d.ts +3 -3
- package/lib/esm/definitions/preload.d.ts +43 -0
- package/lib/esm/definitions/preload.js +31 -0
- package/lib/esm/function-agent.d.ts +15 -56
- package/lib/esm/function-agent.js +9 -6
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/llm-agent.d.ts +17 -60
- package/lib/esm/llm-agent.js +8 -5
- package/lib/esm/llm-decision-agent.d.ts +28 -31
- package/lib/esm/llm-decision-agent.js +4 -4
- package/lib/esm/llm-model.d.ts +4 -4
- package/lib/esm/memorable.d.ts +21 -13
- package/lib/esm/memorable.js +2 -2
- package/lib/esm/open-api-agent.d.ts +9 -38
- package/lib/esm/open-api-agent.js +11 -5
- package/lib/esm/pipeline-agent.d.ts +14 -37
- package/lib/esm/pipeline-agent.js +9 -6
- package/lib/esm/runnable.d.ts +7 -24
- package/lib/esm/sandbox-function-agent.d.ts +10 -38
- package/lib/esm/sandbox-function-agent.js +9 -5
- package/lib/esm/sandbox-function-runner.d.ts +8 -17
- package/lib/esm/sandbox-function-runner.js +2 -1
- package/lib/esm/utils/index.d.ts +1 -0
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/logger.d.ts +3 -0
- package/lib/esm/utils/logger.js +14 -0
- package/lib/esm/utils/message-utils.d.ts +1 -1
- package/lib/esm/utils/message-utils.js +1 -4
- package/lib/esm/utils/open-api-parameter.js +1 -1
- package/lib/esm/utils/runnable-type.d.ts +4 -22
- package/lib/esm/utils/structured-output-schema.d.ts +2 -2
- package/lib/esm/utils/type-utils.d.ts +1 -0
- package/lib/esm/utils/type-utils.js +1 -0
- package/package.json +1 -1
- package/lib/cjs/definitions/data-type-schema.d.ts +0 -42
- package/lib/cjs/logger.d.ts +0 -2
- package/lib/dts/definitions/data-type-schema.d.ts +0 -42
- package/lib/dts/logger.d.ts +0 -2
- package/lib/esm/definitions/data-type-schema.d.ts +0 -42
- package/lib/esm/logger.d.ts +0 -2
- package/lib/esm/logger.js +0 -2
- /package/lib/cjs/definitions/{data-type-schema.js → data-schema.js} +0 -0
- /package/lib/esm/definitions/{data-type-schema.js → data-schema.js} +0 -0
|
@@ -1,64 +1,23 @@
|
|
|
1
|
-
import { Agent, type AgentProcessOptions } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import { type
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare class FunctionAgent<I extends {
|
|
8
|
-
[name: string]: any;
|
|
9
|
-
} = {}, O extends {
|
|
10
|
-
[name: string]: any;
|
|
11
|
-
} = {}, Memories extends {
|
|
12
|
-
[name: string]: MemoryItemWithScore[];
|
|
13
|
-
} = {}, State extends ContextState = ContextState> extends Agent<I, O, Memories, State> {
|
|
14
|
-
definition: FunctionAgentDefinition<I, O, Memories, State>;
|
|
3
|
+
import { type SchemaToType } from "./definitions/data-schema";
|
|
4
|
+
import type { RunnableInput, RunnableOutput, RunnableResponse, RunnableResponseChunk } from "./runnable";
|
|
5
|
+
export declare class FunctionAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
|
|
6
|
+
definition: FunctionAgentDefinition<I, O, State, Preloads, Memories>;
|
|
15
7
|
static create: typeof create;
|
|
16
|
-
constructor(definition: FunctionAgentDefinition<I, O,
|
|
17
|
-
process(input: I, options: AgentProcessOptions<Memories>): Promise<AsyncGenerator<RunnableResponseChunk<O>, void, any> | RunnableResponse<O>>;
|
|
8
|
+
constructor(definition: FunctionAgentDefinition<I, O, State, Preloads, Memories>, context?: Context<State>);
|
|
9
|
+
process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<AsyncGenerator<RunnableResponseChunk<O>, void, any> | RunnableResponse<O>>;
|
|
18
10
|
}
|
|
19
|
-
export interface FunctionAgentDefinition<I extends {
|
|
20
|
-
[name: string]: any;
|
|
21
|
-
}, O extends {
|
|
22
|
-
[name: string]: any;
|
|
23
|
-
}, Memories extends {
|
|
24
|
-
[name: string]: MemoryItemWithScore[];
|
|
25
|
-
}, State extends ContextState> extends RunnableDefinition {
|
|
11
|
+
export interface FunctionAgentDefinition<I extends RunnableInput, O extends RunnableOutput, State extends ContextState, Preloads extends AgentPreloads, Memories extends AgentMemories> extends AgentDefinition {
|
|
26
12
|
type: "function_agent";
|
|
27
|
-
function?: FunctionFuncType<I, O,
|
|
13
|
+
function?: FunctionFuncType<I, O, State, Preloads, Memories>;
|
|
28
14
|
}
|
|
29
|
-
export type FunctionFuncType<I extends {
|
|
30
|
-
[name: string]: any;
|
|
31
|
-
}, O extends {
|
|
32
|
-
[name: string]: any;
|
|
33
|
-
}, Memories extends {
|
|
34
|
-
[name: string]: MemoryItemWithScore[];
|
|
35
|
-
}, State extends ContextState> = (input: I, options: {
|
|
36
|
-
memories: Memories;
|
|
15
|
+
export type FunctionFuncType<I extends RunnableInput, O extends RunnableOutput, State extends ContextState, Preloads extends AgentPreloads, Memories extends AgentMemories> = (input: AgentProcessInput<I, Preloads, Memories>, options: {
|
|
37
16
|
context: Context<State>;
|
|
17
|
+
preloads: Preloads;
|
|
18
|
+
memories: Memories;
|
|
38
19
|
}) => Promise<RunnableResponse<O> | AsyncGenerator<RunnableResponseChunk<O>, void>> | AsyncGenerator<RunnableResponseChunk<O>, void>;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
[name: string]: DataTypeSchema;
|
|
43
|
-
}, Memories extends {
|
|
44
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
45
|
-
}, State extends ContextState> {
|
|
46
|
-
context?: Context<State>;
|
|
47
|
-
name?: string;
|
|
48
|
-
inputs: I;
|
|
49
|
-
outputs: O;
|
|
50
|
-
memories?: Memories;
|
|
51
|
-
function?: FunctionFuncType<SchemaMapType<I>, SchemaMapType<O>, {
|
|
52
|
-
[key in keyof Memories]: MemorableSearchOutput<Memories[key]["memory"]>;
|
|
53
|
-
}, State>;
|
|
54
|
-
}
|
|
55
|
-
declare function create<I extends {
|
|
56
|
-
[name: string]: DataTypeSchema;
|
|
57
|
-
}, O extends {
|
|
58
|
-
[name: string]: DataTypeSchema;
|
|
59
|
-
}, Memories extends {
|
|
60
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
61
|
-
}, State extends ContextState>({ context, ...options }: CreateFunctionAgentOptions<I, O, Memories, State>): FunctionAgent<SchemaMapType<I>, SchemaMapType<O>, {
|
|
62
|
-
[name in keyof Memories]: MemorableSearchOutput<Memories[name]["memory"]>;
|
|
63
|
-
}, State>;
|
|
20
|
+
declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
|
|
21
|
+
function?: FunctionFuncType<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
22
|
+
}): FunctionAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
64
23
|
export {};
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from "./agent";
|
|
|
2
2
|
export * from "./constants";
|
|
3
3
|
export * from "./context";
|
|
4
4
|
export * from "./definitions/data-type";
|
|
5
|
-
export * from "./definitions/data-
|
|
5
|
+
export * from "./definitions/data-schema";
|
|
6
6
|
export * from "./definitions/memory";
|
|
7
7
|
export * from "./definitions/open-api";
|
|
8
8
|
export * from "./function-agent";
|
package/lib/dts/llm-agent.d.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import { Agent, type AgentProcessOptions } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import { type
|
|
4
|
-
import { type CreateRunnableMemory } from "./definitions/memory";
|
|
3
|
+
import { type SchemaToType } from "./definitions/data-schema";
|
|
5
4
|
import type { LLMModel, LLMModelInputMessage, LLMModelInputs } from "./llm-model";
|
|
6
|
-
import type {
|
|
7
|
-
import type { RunnableDefinition } from "./runnable";
|
|
5
|
+
import type { RunnableInput, RunnableOutput } from "./runnable";
|
|
8
6
|
import { OrderedRecord } from "./utils/ordered-map";
|
|
9
|
-
export declare class LLMAgent<I extends {
|
|
10
|
-
[name: string]: any;
|
|
11
|
-
} = {}, O extends {
|
|
12
|
-
[name: string]: any;
|
|
13
|
-
} = {}, Memories extends {
|
|
14
|
-
[name: string]: MemoryItemWithScore[];
|
|
15
|
-
} = {}, State extends ContextState = ContextState> extends Agent<I, O, Memories, State> {
|
|
7
|
+
export declare class LLMAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
|
|
16
8
|
definition: LLMAgentDefinition;
|
|
17
9
|
model?: LLMModel | undefined;
|
|
18
10
|
static create: typeof create;
|
|
19
11
|
constructor(definition: LLMAgentDefinition, context?: Context<State>, model?: LLMModel | undefined);
|
|
20
|
-
process(input: I, options: AgentProcessOptions
|
|
12
|
+
process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions): AsyncGenerator<{
|
|
21
13
|
$text: string | undefined;
|
|
22
14
|
delta?: undefined;
|
|
23
15
|
} | {
|
|
@@ -27,7 +19,7 @@ export declare class LLMAgent<I extends {
|
|
|
27
19
|
private runWithStructuredOutput;
|
|
28
20
|
private runWithTextOutput;
|
|
29
21
|
}
|
|
30
|
-
export interface LLMAgentDefinition extends
|
|
22
|
+
export interface LLMAgentDefinition extends AgentDefinition {
|
|
31
23
|
type: "llm_agent";
|
|
32
24
|
primaryMemoryId?: string;
|
|
33
25
|
messages?: OrderedRecord<LLMModelInputMessage & {
|
|
@@ -36,32 +28,19 @@ export interface LLMAgentDefinition extends RunnableDefinition {
|
|
|
36
28
|
modelOptions?: LLMModelInputs["modelOptions"];
|
|
37
29
|
}
|
|
38
30
|
/**
|
|
39
|
-
*
|
|
31
|
+
* Create LLMAgent definition.
|
|
32
|
+
* @param options Options to create LLMAgent.
|
|
33
|
+
* @returns LLMAgent definition.
|
|
40
34
|
*/
|
|
41
|
-
|
|
42
|
-
[name: string]: DataTypeSchema;
|
|
43
|
-
}, O extends {
|
|
44
|
-
[name: string]: DataTypeSchema;
|
|
45
|
-
}, Memories extends {
|
|
46
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
47
|
-
}, State extends ContextState> {
|
|
48
|
-
context?: Context<State>;
|
|
49
|
-
/**
|
|
50
|
-
* Agent name, used to identify the agent.
|
|
51
|
-
*/
|
|
52
|
-
name?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Input variables for this agent.
|
|
55
|
-
*/
|
|
56
|
-
inputs: I;
|
|
35
|
+
declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I, {
|
|
57
36
|
/**
|
|
58
|
-
*
|
|
37
|
+
* Whether this memory is primary? Primary memory will be passed as messages to LLM chat model,
|
|
38
|
+
* otherwise, it will be placed in a system message.
|
|
39
|
+
*
|
|
40
|
+
* Only one primary memory is allowed.
|
|
59
41
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* Memories to be used in this agent.
|
|
63
|
-
*/
|
|
64
|
-
memories?: Memories;
|
|
42
|
+
primary?: boolean;
|
|
43
|
+
}>>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
|
|
65
44
|
/**
|
|
66
45
|
* Options for LLM chat model.
|
|
67
46
|
*/
|
|
@@ -70,27 +49,5 @@ export interface CreateLLMAgentOptions<I extends {
|
|
|
70
49
|
* Messages to be passed to LLM chat model.
|
|
71
50
|
*/
|
|
72
51
|
messages?: LLMModelInputMessage[];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Create LLMAgent definition.
|
|
76
|
-
* @param options Options to create LLMAgent.
|
|
77
|
-
* @returns LLMAgent definition.
|
|
78
|
-
*/
|
|
79
|
-
declare function create<I extends {
|
|
80
|
-
[name: string]: DataTypeSchema;
|
|
81
|
-
}, O extends {
|
|
82
|
-
[name: string]: DataTypeSchema;
|
|
83
|
-
}, Memories extends {
|
|
84
|
-
[name: string]: CreateRunnableMemory<I> & {
|
|
85
|
-
/**
|
|
86
|
-
* Whether this memory is primary? Primary memory will be passed as messages to LLM chat model,
|
|
87
|
-
* otherwise, it will be placed in a system message.
|
|
88
|
-
*
|
|
89
|
-
* Only one primary memory is allowed.
|
|
90
|
-
*/
|
|
91
|
-
primary?: boolean;
|
|
92
|
-
};
|
|
93
|
-
}, State extends ContextState>({ context, ...options }: CreateLLMAgentOptions<I, O, Memories, State>): LLMAgent<SchemaMapType<I>, SchemaMapType<O>, {
|
|
94
|
-
[name in keyof Memories]: MemorableSearchOutput<Memories[name]["memory"]>;
|
|
95
|
-
}, State>;
|
|
52
|
+
}): LLMAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
96
53
|
export {};
|
|
@@ -1,44 +1,41 @@
|
|
|
1
|
-
import { Agent, type AgentProcessOptions } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
3
|
+
import type { TypeToSchema } from "./definitions/data-schema";
|
|
4
|
+
import type { BindAgentInput, BoundAgent, OmitBoundAgentInput } from "./definitions/preload";
|
|
5
|
+
import type { LLMAgentDefinition } from "./llm-agent";
|
|
6
|
+
import type { LLMModel, LLMModelInputMessage, LLMModelInputs } from "./llm-model";
|
|
7
|
+
import type { RunnableInput, RunnableOutput } from "./runnable";
|
|
8
8
|
import { OrderedRecord } from "./utils";
|
|
9
|
-
import type {
|
|
10
|
-
export declare class LLMDecisionAgent<I extends {
|
|
11
|
-
[name: string]: any;
|
|
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> {
|
|
9
|
+
import type { ExtractRunnableInputTypeIntersection, ExtractRunnableOutputType } from "./utils/runnable-type";
|
|
10
|
+
export declare class LLMDecisionAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
|
|
17
11
|
definition: LLMDecisionAgentDefinition;
|
|
18
12
|
model?: LLMModel | undefined;
|
|
19
13
|
static create: typeof create;
|
|
20
14
|
constructor(definition: LLMDecisionAgentDefinition, context?: Context<State>, model?: LLMModel | undefined);
|
|
21
|
-
process(input: I, options: AgentProcessOptions<Memories>): Promise<import("./runnable").RunnableResponse<O>>;
|
|
15
|
+
process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<import("./runnable").RunnableResponse<O>>;
|
|
22
16
|
}
|
|
23
|
-
declare function create<Case extends BoundAgent,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
}, State extends ContextState>({ context, ...options }: Pick<CreateLLMAgentOptions<I, O, Memories, State>, "name" | "memories" | "messages" | "modelOptions"> & {
|
|
34
|
-
context: Context<State>;
|
|
17
|
+
declare function create<Case extends BoundAgent, InputType extends ExtractRunnableInputTypeIntersection<Case["runnable"]>, OutputType extends ExtractRunnableOutputType<Case["runnable"]>, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<TypeToSchema<InputType>>, Memories extends CreateAgentMemoriesSchema<TypeToSchema<InputType>, {
|
|
18
|
+
/**
|
|
19
|
+
* Whether this memory is primary? Primary memory will be passed as messages to LLM chat model,
|
|
20
|
+
* otherwise, it will be placed in a system message.
|
|
21
|
+
*
|
|
22
|
+
* Only one primary memory is allowed.
|
|
23
|
+
*/
|
|
24
|
+
primary?: boolean;
|
|
25
|
+
}>>(options: Omit<CreateAgentOptions<never, never, State, Preloads, Memories>, "inputs" | "outputs"> & {
|
|
35
26
|
cases: {
|
|
36
27
|
[name: string]: Case;
|
|
37
28
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Options for LLM chat model.
|
|
31
|
+
*/
|
|
32
|
+
modelOptions?: LLMModelInputs["modelOptions"];
|
|
33
|
+
/**
|
|
34
|
+
* Messages to be passed to LLM chat model.
|
|
35
|
+
*/
|
|
36
|
+
messages?: LLMModelInputMessage[];
|
|
37
|
+
}): LLMDecisionAgent<OmitBoundAgentInput<Case, "ai">, OutputType, State, CreateAgentPreloadsType<TypeToSchema<InputType>, Preloads>, CreateAgentMemoriesType<TypeToSchema<InputType>, Memories>>;
|
|
38
|
+
export interface LLMDecisionAgentDefinition extends AgentDefinition, Pick<LLMAgentDefinition, "modelOptions" | "messages" | "primaryMemoryId"> {
|
|
42
39
|
type: "llm_decision_agent";
|
|
43
40
|
cases?: OrderedRecord<LLMDecisionCase>;
|
|
44
41
|
}
|
package/lib/dts/llm-model.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Agent } from "./agent";
|
|
2
2
|
import type { Context } from "./context";
|
|
3
3
|
export type Role = "system" | "user" | "assistant" | "tool";
|
|
4
|
-
export
|
|
4
|
+
export type LLMModelInputs = {
|
|
5
5
|
messages: LLMModelInputMessage[];
|
|
6
6
|
responseFormat?: {
|
|
7
7
|
type: "text";
|
|
@@ -23,7 +23,7 @@ export interface LLMModelInputs {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
modelOptions?: LLMModelOptions;
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
export interface LLMModelInputMessage {
|
|
28
28
|
role: Role;
|
|
29
29
|
content: string | ({
|
|
@@ -60,7 +60,7 @@ export interface LLMModelOptions {
|
|
|
60
60
|
frequencyPenalty?: number;
|
|
61
61
|
presencePenalty?: number;
|
|
62
62
|
}
|
|
63
|
-
export
|
|
63
|
+
export type LLMModelOutputs = {
|
|
64
64
|
$text?: string | null;
|
|
65
65
|
toolCalls?: {
|
|
66
66
|
id?: string;
|
|
@@ -70,7 +70,7 @@ export interface LLMModelOutputs {
|
|
|
70
70
|
arguments?: string;
|
|
71
71
|
};
|
|
72
72
|
}[];
|
|
73
|
-
}
|
|
73
|
+
};
|
|
74
74
|
export declare abstract class LLMModel extends Agent<LLMModelInputs, LLMModelOutputs> {
|
|
75
75
|
constructor(context?: Context);
|
|
76
76
|
}
|
package/lib/dts/memorable.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type { Context } from "./context";
|
|
1
2
|
import type { LLMModelInputMessage } from "./llm-model";
|
|
2
3
|
import { Runnable } from "./runnable";
|
|
3
|
-
export
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}
|
|
4
|
+
export type MemoryMetadata = Record<string, unknown>;
|
|
6
5
|
export type MemoryActionItem<T> = {
|
|
7
6
|
event: "add";
|
|
8
7
|
id: string;
|
|
@@ -31,7 +30,7 @@ export interface MemoryItem<T> {
|
|
|
31
30
|
memory: T;
|
|
32
31
|
metadata: MemoryMetadata;
|
|
33
32
|
}
|
|
34
|
-
export interface MemoryItemWithScore<T =
|
|
33
|
+
export interface MemoryItemWithScore<T = unknown> extends MemoryItem<T> {
|
|
35
34
|
score: number;
|
|
36
35
|
}
|
|
37
36
|
export type MemoryMessage = LLMModelInputMessage;
|
|
@@ -110,13 +109,19 @@ export type MemoryActions<T> = {
|
|
|
110
109
|
} | {
|
|
111
110
|
action: "delete";
|
|
112
111
|
inputs: {
|
|
113
|
-
filter: string | string[] | Record<string,
|
|
112
|
+
filter: string | string[] | Record<string, unknown>;
|
|
113
|
+
};
|
|
114
|
+
outputs: {
|
|
115
|
+
[name: string]: never;
|
|
114
116
|
};
|
|
115
|
-
outputs: {};
|
|
116
117
|
} | {
|
|
117
118
|
action: "reset";
|
|
118
|
-
inputs: {
|
|
119
|
-
|
|
119
|
+
inputs: {
|
|
120
|
+
[name: string]: never;
|
|
121
|
+
};
|
|
122
|
+
outputs: {
|
|
123
|
+
[name: string]: never;
|
|
124
|
+
};
|
|
120
125
|
};
|
|
121
126
|
export interface SortItem {
|
|
122
127
|
field: string;
|
|
@@ -124,7 +129,7 @@ export interface SortItem {
|
|
|
124
129
|
}
|
|
125
130
|
export type MemorySortOptions = SortItem | SortItem[];
|
|
126
131
|
export declare abstract class Memorable<T, C = undefined> extends Runnable<MemoryActions<T>, MemoryActions<T>["outputs"]> {
|
|
127
|
-
constructor();
|
|
132
|
+
constructor(context?: Context);
|
|
128
133
|
abstract runner?: MemoryRunner<T, C>;
|
|
129
134
|
abstract add(messages: Extract<MemoryActions<T>, {
|
|
130
135
|
action: "add";
|
|
@@ -169,15 +174,18 @@ export declare abstract class Memorable<T, C = undefined> extends Runnable<Memor
|
|
|
169
174
|
}>["outputs"]>;
|
|
170
175
|
abstract reset(): Promise<void>;
|
|
171
176
|
}
|
|
172
|
-
export
|
|
177
|
+
export type MemoryRunnerInput<C = undefined> = {
|
|
173
178
|
messages: MemoryMessage[];
|
|
174
179
|
userId?: string;
|
|
175
180
|
sessionId?: string;
|
|
176
181
|
metadata?: MemoryMetadata;
|
|
177
182
|
filter?: MemoryMetadata;
|
|
178
183
|
customData: C;
|
|
179
|
-
}
|
|
180
|
-
export
|
|
184
|
+
};
|
|
185
|
+
export type MemoryRunnerOutput<T> = {
|
|
186
|
+
actions: MemoryActionItem<T>[];
|
|
187
|
+
};
|
|
188
|
+
export declare abstract class MemoryRunner<T, C = undefined> extends Runnable<MemoryRunnerInput<C>, MemoryRunnerOutput<T>> {
|
|
181
189
|
constructor(name: string);
|
|
182
190
|
}
|
|
183
|
-
export type MemorableSearchOutput<T extends Memorable<
|
|
191
|
+
export type MemorableSearchOutput<T extends Memorable<unknown>> = Awaited<ReturnType<T["search"]>>["results"];
|
|
@@ -1,55 +1,26 @@
|
|
|
1
|
-
import { Agent } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import { type
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { MemorableSearchOutput, MemoryItemWithScore } from "./memorable";
|
|
7
|
-
import type { RunnableDefinition } from "./runnable";
|
|
3
|
+
import { type SchemaToType } from "./definitions/data-schema";
|
|
4
|
+
import type { AuthConfig, FetchRequest, HTTPMethod, OpenAPIDataType } from "./definitions/open-api";
|
|
5
|
+
import type { RunnableInput, RunnableOutput } from "./runnable";
|
|
8
6
|
import type { OrderedRecord } from "./utils";
|
|
9
|
-
export declare class OpenAPIAgent<I extends {
|
|
10
|
-
[name: string]: any;
|
|
11
|
-
} = {}, O extends {
|
|
12
|
-
[name: string]: any;
|
|
13
|
-
} = {}, Memories extends {
|
|
14
|
-
[name: string]: MemoryItemWithScore[];
|
|
15
|
-
} = {}, State extends ContextState = ContextState> extends Agent<I, O, Memories, State> {
|
|
7
|
+
export declare class OpenAPIAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
|
|
16
8
|
definition: OpenAPIAgentDefinition;
|
|
17
9
|
static create: typeof create;
|
|
18
10
|
constructor(definition: OpenAPIAgentDefinition, context?: Context<State>);
|
|
19
|
-
process(input: I): Promise<O>;
|
|
11
|
+
process(input: AgentProcessInput<I, Preloads, Memories>): Promise<O>;
|
|
20
12
|
fetch<T>(request: FetchRequest): Promise<T>;
|
|
21
13
|
}
|
|
22
|
-
export interface OpenAPIAgentDefinition extends
|
|
14
|
+
export interface OpenAPIAgentDefinition extends AgentDefinition {
|
|
23
15
|
type: "open_api_agent";
|
|
24
16
|
inputs: OrderedRecord<OpenAPIDataType>;
|
|
25
17
|
url: string;
|
|
26
18
|
method?: HTTPMethod;
|
|
27
19
|
auth?: AuthConfig;
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
[name: string]: OpenAPIDataTypeSchema;
|
|
31
|
-
}, O extends {
|
|
32
|
-
[name: string]: DataTypeSchema;
|
|
33
|
-
}, Memories extends {
|
|
34
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
35
|
-
}, State extends ContextState> {
|
|
36
|
-
context?: Context<State>;
|
|
37
|
-
id?: string;
|
|
38
|
-
name?: string;
|
|
39
|
-
inputs: I;
|
|
40
|
-
outputs: O;
|
|
41
|
-
memories?: Memories;
|
|
21
|
+
declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
|
|
42
22
|
url: string;
|
|
43
23
|
method?: HTTPMethod;
|
|
44
24
|
auth?: AuthConfig;
|
|
45
|
-
}
|
|
46
|
-
declare function create<I extends {
|
|
47
|
-
[name: string]: OpenAPIDataTypeSchema;
|
|
48
|
-
}, O extends {
|
|
49
|
-
[name: string]: DataTypeSchema;
|
|
50
|
-
}, Memories extends {
|
|
51
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
52
|
-
}, State extends ContextState>({ context, ...options }: CreateOpenAPIAgentOptions<I, O, Memories, State>): OpenAPIAgent<SchemaMapType<I>, SchemaMapType<O>, {
|
|
53
|
-
[name in keyof Memories]: MemorableSearchOutput<Memories[name]["memory"]>;
|
|
54
|
-
}, State>;
|
|
25
|
+
}): OpenAPIAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
55
26
|
export {};
|
|
@@ -1,63 +1,40 @@
|
|
|
1
|
-
import { Agent, type AgentProcessOptions } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import { type
|
|
4
|
-
import {
|
|
5
|
-
import type { MemorableSearchOutput, MemoryItemWithScore } from "./memorable";
|
|
6
|
-
import type { Runnable, RunnableDefinition, RunnableOutput, RunnableResponseDelta } from "./runnable";
|
|
3
|
+
import { type SchemaToType } from "./definitions/data-schema";
|
|
4
|
+
import type { Runnable, RunnableInput, RunnableOutput, RunnableOutputType, RunnableResponseDelta } from "./runnable";
|
|
7
5
|
import type { MakeNullablePropertyOptional } from "./utils/nullable";
|
|
8
6
|
import { OrderedRecord } from "./utils/ordered-map";
|
|
9
7
|
import type { ExtractRunnableInputType } from "./utils/runnable-type";
|
|
10
|
-
export declare class PipelineAgent<I extends {
|
|
11
|
-
[key: string]: any;
|
|
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
|
+
export declare class PipelineAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, AgentPreloads, Memories> {
|
|
17
9
|
definition: PipelineAgentDefinition;
|
|
18
10
|
static create: typeof create;
|
|
19
11
|
constructor(definition: PipelineAgentDefinition, context?: Context<State>);
|
|
20
|
-
process(input: I, options: AgentProcessOptions<Memories>): Promise<import("stream/web").ReadableStream<RunnableResponseDelta<O>>>;
|
|
12
|
+
process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<import("stream/web").ReadableStream<RunnableResponseDelta<O>>>;
|
|
21
13
|
}
|
|
22
14
|
type VariableWithPropPath = {
|
|
23
15
|
fromVariable: string;
|
|
24
16
|
fromVariablePropPath?: (string | number)[];
|
|
25
17
|
};
|
|
26
|
-
export type PipelineAgentProcessParameter<R extends Runnable =
|
|
27
|
-
[name: string]: DataTypeSchema;
|
|
28
|
-
} = ExtractRunnableInputType<R>> = {
|
|
18
|
+
export type PipelineAgentProcessParameter<R extends Runnable = Runnable, RI extends RunnableInput = ExtractRunnableInputType<R>> = {
|
|
29
19
|
runnable: R;
|
|
30
20
|
input: MakeNullablePropertyOptional<{
|
|
31
21
|
[key in keyof RI]: VariableWithPropPath;
|
|
32
22
|
}>;
|
|
33
23
|
};
|
|
34
|
-
declare function create<I extends {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
fromVariable: string;
|
|
39
|
-
fromVariablePropPath?: string[];
|
|
40
|
-
};
|
|
41
|
-
}, Memories extends {
|
|
42
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
43
|
-
}, State extends ContextState, Processes extends {
|
|
24
|
+
declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema<{
|
|
25
|
+
fromVariable: string;
|
|
26
|
+
fromVariablePropPath?: string[];
|
|
27
|
+
}>, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>, Processes extends {
|
|
44
28
|
[name: string]: PipelineAgentProcessParameter;
|
|
45
|
-
}>(
|
|
46
|
-
context: Context<State>;
|
|
47
|
-
name?: string;
|
|
48
|
-
inputs: I;
|
|
49
|
-
outputs: O;
|
|
50
|
-
memories?: Memories;
|
|
29
|
+
}>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
|
|
51
30
|
processes: Processes;
|
|
52
|
-
}): PipelineAgent<
|
|
53
|
-
|
|
54
|
-
}, State>;
|
|
55
|
-
export interface PipelineAgentDefinition extends RunnableDefinition {
|
|
31
|
+
}): PipelineAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
32
|
+
export interface PipelineAgentDefinition extends AgentDefinition {
|
|
56
33
|
type: "pipeline_agent";
|
|
57
34
|
processes?: OrderedRecord<PipelineAgentProcess>;
|
|
58
35
|
outputs: OrderedRecord<PipelineAgentOutput>;
|
|
59
36
|
}
|
|
60
|
-
export type PipelineAgentOutput =
|
|
37
|
+
export type PipelineAgentOutput = RunnableOutputType & {
|
|
61
38
|
from: "variable";
|
|
62
39
|
fromVariableId?: string;
|
|
63
40
|
fromVariablePropPath?: (string | number)[];
|
package/lib/dts/runnable.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { Context, ContextState } from "./context";
|
|
2
2
|
import type { DataType } from "./definitions/data-type";
|
|
3
|
-
import type { Memorable } from "./memorable";
|
|
4
3
|
import { OrderedRecord } from "./utils/ordered-map";
|
|
5
4
|
export interface RunOptions {
|
|
6
5
|
stream?: boolean;
|
|
7
6
|
}
|
|
8
7
|
export type RunnableResponse<T> = T | RunnableResponseStream<T>;
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[name: string]: any;
|
|
13
|
-
} = {}, State extends ContextState = ContextState> {
|
|
8
|
+
export type RunnableInput = Record<string, any>;
|
|
9
|
+
export type RunnableOutput = Record<string, any>;
|
|
10
|
+
export declare abstract class Runnable<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState> {
|
|
14
11
|
definition: RunnableDefinition;
|
|
15
12
|
context?: Context<State> | undefined;
|
|
16
13
|
constructor(definition: RunnableDefinition, context?: Context<State> | undefined);
|
|
@@ -35,25 +32,11 @@ export interface RunnableDefinition {
|
|
|
35
32
|
type: string;
|
|
36
33
|
name?: string;
|
|
37
34
|
description?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
outputs: OrderedRecord<RunnableOutput>;
|
|
35
|
+
inputs: OrderedRecord<RunnableInputType>;
|
|
36
|
+
outputs: OrderedRecord<RunnableOutputType>;
|
|
41
37
|
}
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
name?: string;
|
|
45
|
-
memory?: Memorable<any>;
|
|
46
|
-
query?: {
|
|
47
|
-
from: "variable";
|
|
48
|
-
fromVariableId?: string;
|
|
49
|
-
fromVariablePropPath?: string[];
|
|
50
|
-
};
|
|
51
|
-
options?: {
|
|
52
|
-
k?: number;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export type RunnableInput = DataType;
|
|
56
|
-
export type RunnableOutput = DataType;
|
|
38
|
+
export type RunnableInputType = DataType;
|
|
39
|
+
export type RunnableOutputType = DataType;
|
|
57
40
|
export interface RunnableResponseDelta<T> {
|
|
58
41
|
$text?: string;
|
|
59
42
|
delta?: Partial<T>;
|
|
@@ -1,48 +1,20 @@
|
|
|
1
|
-
import { Agent, type AgentProcessOptions } from "./agent";
|
|
1
|
+
import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
|
|
2
2
|
import type { Context, ContextState } from "./context";
|
|
3
|
-
import { type
|
|
4
|
-
import {
|
|
5
|
-
import type { MemorableSearchOutput, MemoryItemWithScore } from "./memorable";
|
|
6
|
-
import type { RunnableDefinition } from "./runnable";
|
|
3
|
+
import { type SchemaToType } from "./definitions/data-schema";
|
|
4
|
+
import type { RunnableInput, RunnableOutput } from "./runnable";
|
|
7
5
|
import type { SandboxFunctionRunner } from "./sandbox-function-runner";
|
|
8
|
-
export declare class SandboxFunctionAgent<I extends {
|
|
9
|
-
[name: string]: any;
|
|
10
|
-
} = {}, O extends {
|
|
11
|
-
[name: string]: any;
|
|
12
|
-
} = {}, Memories extends {
|
|
13
|
-
[name: string]: MemoryItemWithScore[];
|
|
14
|
-
} = {}, State extends ContextState = ContextState> extends Agent<I, O, Memories, State> {
|
|
6
|
+
export declare class SandboxFunctionAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
|
|
15
7
|
definition: SandboxFunctionAgentDefinition;
|
|
16
|
-
runner?: SandboxFunctionRunner<I, O,
|
|
8
|
+
runner?: SandboxFunctionRunner<I, O, State, Preloads, Memories> | undefined;
|
|
17
9
|
static create: typeof create;
|
|
18
|
-
constructor(definition: SandboxFunctionAgentDefinition, context?: Context<State>, runner?: SandboxFunctionRunner<I, O,
|
|
19
|
-
process(input: I, options: AgentProcessOptions<Memories>): Promise<import("./runnable").RunnableResponseStream<O>>;
|
|
10
|
+
constructor(definition: SandboxFunctionAgentDefinition, context?: Context<State>, runner?: SandboxFunctionRunner<I, O, State, Preloads, Memories> | undefined);
|
|
11
|
+
process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<import("./runnable").RunnableResponseStream<O>>;
|
|
20
12
|
}
|
|
21
|
-
export
|
|
22
|
-
[name: string]: DataTypeSchema;
|
|
23
|
-
}, O extends {
|
|
24
|
-
[name: string]: DataTypeSchema;
|
|
25
|
-
}, Memories extends {
|
|
26
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
27
|
-
}, State extends ContextState> {
|
|
28
|
-
context?: Context<State>;
|
|
29
|
-
name?: string;
|
|
30
|
-
inputs: I;
|
|
31
|
-
outputs: O;
|
|
32
|
-
memories?: Memories;
|
|
13
|
+
export declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
|
|
33
14
|
language?: string;
|
|
34
15
|
code: string;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
37
|
-
[name: string]: DataTypeSchema;
|
|
38
|
-
}, O extends {
|
|
39
|
-
[name: string]: DataTypeSchema;
|
|
40
|
-
}, Memories extends {
|
|
41
|
-
[name: string]: CreateRunnableMemory<I>;
|
|
42
|
-
}, State extends ContextState>({ context, ...options }: CreateSandboxFunctionAgentOptions<I, O, Memories, State>): SandboxFunctionAgent<SchemaMapType<I>, SchemaMapType<O>, {
|
|
43
|
-
[name in keyof Memories]: MemorableSearchOutput<Memories[name]["memory"]>;
|
|
44
|
-
}, State>;
|
|
45
|
-
export interface SandboxFunctionAgentDefinition extends RunnableDefinition {
|
|
16
|
+
}): SandboxFunctionAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
|
|
17
|
+
export interface SandboxFunctionAgentDefinition extends AgentDefinition {
|
|
46
18
|
type: "sandbox_function_agent";
|
|
47
19
|
language?: string;
|
|
48
20
|
code?: string;
|