graphai 0.6.10 → 0.6.12
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/bundle.cjs.js +1 -1
- package/lib/bundle.cjs.js.map +1 -1
- package/lib/bundle.esm.js +3 -2
- package/lib/bundle.esm.js.map +1 -1
- package/lib/bundle.umd.js +1 -1
- package/lib/bundle.umd.js.map +1 -1
- package/lib/graphai.d.ts +2 -2
- package/lib/node.d.ts +1 -0
- package/lib/node.js +3 -2
- package/lib/type.d.ts +10 -6
- package/package.json +1 -1
package/lib/node.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class ComputedNode extends Node {
|
|
|
20
20
|
readonly params: NodeDataParams;
|
|
21
21
|
private readonly filterParams;
|
|
22
22
|
readonly nestedGraph?: GraphData | DataSource;
|
|
23
|
+
private readonly config?;
|
|
23
24
|
readonly retryLimit: number;
|
|
24
25
|
retryCount: number;
|
|
25
26
|
private readonly agentId?;
|
package/lib/node.js
CHANGED
|
@@ -74,6 +74,7 @@ class ComputedNode extends Node {
|
|
|
74
74
|
const agent = data.agent;
|
|
75
75
|
this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);
|
|
76
76
|
}
|
|
77
|
+
this.config = this.agentId ? (data.graph ? this.graph.config : ((this.graph.config ?? {})[this.agentId] ?? {})) : {};
|
|
77
78
|
this.anyInput = data.anyInput ?? false;
|
|
78
79
|
this.inputs = data.inputs;
|
|
79
80
|
this.output = data.output;
|
|
@@ -241,7 +242,7 @@ class ComputedNode extends Node {
|
|
|
241
242
|
agentFilters: this.graph.agentFilters,
|
|
242
243
|
taskManager: this.graph.taskManager,
|
|
243
244
|
bypassAgentIds: this.graph.bypassAgentIds,
|
|
244
|
-
config: this.
|
|
245
|
+
config: this.config,
|
|
245
246
|
graphLoader: this.graph.graphLoader,
|
|
246
247
|
},
|
|
247
248
|
onLogCallback: this.graph.onLogCallback,
|
|
@@ -314,7 +315,7 @@ class ComputedNode extends Node {
|
|
|
314
315
|
cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.cacheType,
|
|
315
316
|
filterParams: this.filterParams,
|
|
316
317
|
agentFilters: this.graph.agentFilters,
|
|
317
|
-
config: this.
|
|
318
|
+
config: this.config,
|
|
318
319
|
log: localLog,
|
|
319
320
|
};
|
|
320
321
|
return context;
|
package/lib/type.d.ts
CHANGED
|
@@ -13,8 +13,11 @@ export declare enum NodeState {
|
|
|
13
13
|
}
|
|
14
14
|
export type DefaultResultData = Record<string, any> | string | number | boolean | Array<DefaultResultData>;
|
|
15
15
|
export type DefaultInputData = Record<string, any>;
|
|
16
|
+
export type DefaultConfigData = Record<string, any>;
|
|
16
17
|
export type ResultData<ResultType = DefaultResultData> = ResultType | undefined;
|
|
17
18
|
export type ResultDataDictionary<ResultType = DefaultResultData> = Record<string, ResultData<ResultType>>;
|
|
19
|
+
export type ConfigData<ConfigType = DefaultConfigData> = ConfigType;
|
|
20
|
+
export type ConfigDataDictionary<ConfigType = DefaultConfigData> = Record<string, ConfigType>;
|
|
18
21
|
export type DefaultParamsType = Record<string, any>;
|
|
19
22
|
export type NodeDataParams<ParamsType = DefaultParamsType> = ParamsType;
|
|
20
23
|
export type PassThrough = Record<string, any>;
|
|
@@ -78,11 +81,11 @@ export type GraphOptions = {
|
|
|
78
81
|
agentFilters?: AgentFilterInfo[] | undefined;
|
|
79
82
|
taskManager?: TaskManager | undefined;
|
|
80
83
|
bypassAgentIds?: string[] | undefined;
|
|
81
|
-
config?:
|
|
84
|
+
config?: ConfigDataDictionary;
|
|
82
85
|
graphLoader?: GraphDataLoader;
|
|
83
86
|
};
|
|
84
87
|
export type CacheTypes = "pureAgent" | "impureAgent";
|
|
85
|
-
export type AgentFunctionContext<ParamsType = DefaultParamsType, NamedInputDataType = DefaultInputData> = {
|
|
88
|
+
export type AgentFunctionContext<ParamsType = DefaultParamsType, NamedInputDataType = DefaultInputData, ConfigType = DefaultConfigData> = {
|
|
86
89
|
params: NodeDataParams<ParamsType>;
|
|
87
90
|
inputSchema?: any;
|
|
88
91
|
namedInputs: NamedInputDataType;
|
|
@@ -104,9 +107,9 @@ export type AgentFunctionContext<ParamsType = DefaultParamsType, NamedInputDataT
|
|
|
104
107
|
filterParams: AgentFilterParams;
|
|
105
108
|
agentFilters?: AgentFilterInfo[];
|
|
106
109
|
log?: TransactionLog[];
|
|
107
|
-
config?:
|
|
110
|
+
config?: ConfigType;
|
|
108
111
|
};
|
|
109
|
-
export type AgentFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, NamedInputDataType = DefaultInputData> = (context: AgentFunctionContext<ParamsType, NamedInputDataType>) => Promise<ResultData<ResultType>>;
|
|
112
|
+
export type AgentFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, NamedInputDataType = DefaultInputData, ConfigType = DefaultConfigData> = (context: AgentFunctionContext<ParamsType, NamedInputDataType, ConfigType>) => Promise<ResultData<ResultType>>;
|
|
110
113
|
export type AgentFilterFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, NamedInputDataType = DefaultInputData> = (context: AgentFunctionContext<ParamsType, NamedInputDataType>, agent: AgentFunction) => Promise<ResultData<ResultType>>;
|
|
111
114
|
export type AgentFilterInfo = {
|
|
112
115
|
name: string;
|
|
@@ -123,12 +126,13 @@ export type AgentFunctionInfoSample = {
|
|
|
123
126
|
};
|
|
124
127
|
export type AgentFunctionInfo = {
|
|
125
128
|
name: string;
|
|
126
|
-
agent: AgentFunction<any, any, any>;
|
|
127
|
-
mock: AgentFunction<any, any, any>;
|
|
129
|
+
agent: AgentFunction<any, any, any, any>;
|
|
130
|
+
mock: AgentFunction<any, any, any, any>;
|
|
128
131
|
inputs?: any;
|
|
129
132
|
output?: any;
|
|
130
133
|
outputFormat?: any;
|
|
131
134
|
params?: any;
|
|
135
|
+
config?: any;
|
|
132
136
|
samples: AgentFunctionInfoSample[];
|
|
133
137
|
description: string;
|
|
134
138
|
category: string[];
|