graphai 0.4.0 → 0.4.2
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/README.md +1 -1
- package/lib/experimental_agents/array_agents/pop_agent.d.ts +1 -1
- package/lib/experimental_agents/array_agents/push_agent.d.ts +17 -3
- package/lib/experimental_agents/array_agents/push_agent.js +15 -1
- package/lib/experimental_agents/array_agents/shift_agent.d.ts +1 -1
- package/lib/experimental_agents/data_agents/copy_agent.d.ts +1 -1
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.d.ts +1 -1
- package/lib/experimental_agents/data_agents/data_sum_template_agent.d.ts +1 -1
- package/lib/experimental_agents/data_agents/property_filter_agent.d.ts +43 -13
- package/lib/experimental_agents/data_agents/property_filter_agent.js +31 -12
- package/lib/experimental_agents/data_agents/total_agent.d.ts +1 -1
- package/lib/experimental_agents/embedding_agent.d.ts +1 -1
- package/lib/experimental_agents/function_agent.d.ts +1 -1
- package/lib/experimental_agents/graph_agents/map_agent.d.ts +4 -4
- package/lib/experimental_agents/graph_agents/map_agent.js +5 -5
- package/lib/experimental_agents/graph_agents/nested_agent.d.ts +4 -4
- package/lib/experimental_agents/graph_agents/nested_agent.js +4 -4
- package/lib/experimental_agents/index.d.ts +1 -0
- package/lib/experimental_agents/index.js +1 -0
- package/lib/experimental_agents/input_agents/index.d.ts +2 -0
- package/lib/experimental_agents/input_agents/index.js +8 -0
- package/lib/experimental_agents/input_agents/packages.d.ts +2 -0
- package/lib/experimental_agents/input_agents/packages.js +8 -0
- package/lib/experimental_agents/input_agents/text_input_agent.d.ts +26 -0
- package/lib/experimental_agents/input_agents/text_input_agent.js +23 -0
- package/lib/experimental_agents/llm_agents/groq_agent.d.ts +13 -10
- package/lib/experimental_agents/llm_agents/groq_agent.js +32 -5
- package/lib/experimental_agents/llm_agents/groq_stream_agent.d.ts +1 -1
- package/lib/experimental_agents/llm_agents/openai_agent.d.ts +5 -1
- package/lib/experimental_agents/llm_agents/openai_agent.js +2 -0
- package/lib/experimental_agents/llm_agents/slashgpt_agent.d.ts +1 -1
- package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +1 -1
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.d.ts +1 -1
- package/lib/experimental_agents/service_agents/fetch_agent.d.ts +1 -1
- package/lib/experimental_agents/service_agents/wikipedia.d.ts +1 -1
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.d.ts +1 -1
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.d.ts +1 -1
- package/lib/experimental_agents/string_agents/string_splitter_agent.d.ts +2 -33
- package/lib/experimental_agents/string_agents/string_template_agent.d.ts +51 -9
- package/lib/experimental_agents/string_agents/string_template_agent.js +36 -9
- package/lib/experimental_agents/test_agents/bypass_agent.d.ts +1 -1
- package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +1 -1
- package/lib/experimental_agents/test_agents/copy_message_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/counting_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/echo_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/merge_node_id_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/stream_mock_agent.d.ts +1 -2
- package/lib/experimental_agents/token_agent.d.ts +1 -1
- package/lib/experimental_agents/vanilla.d.ts +3 -2
- package/lib/experimental_agents/vanilla.js +8 -2
- package/lib/graphai.d.ts +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -1
- package/lib/node.d.ts +2 -1
- package/lib/node.js +7 -0
- package/lib/type.d.ts +1 -0
- package/lib/utils/test_agents.d.ts +1 -1
- package/lib/utils/test_utils.d.ts +11 -24
- package/lib/utils/test_utils.js +3 -24
- package/lib/utils/utils.d.ts +29 -1
- package/lib/utils/utils.js +24 -1
- package/lib/validators/common.js +14 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -418,7 +418,7 @@ Step 1. Install git, node and yarn
|
|
|
418
418
|
Step 2. Clone the project and install necessary node modules
|
|
419
419
|
|
|
420
420
|
```
|
|
421
|
-
git clone git@github.com:
|
|
421
|
+
git clone git@github.com:receptron/graphai.git
|
|
422
422
|
cd graphai
|
|
423
423
|
yarn install
|
|
424
424
|
```
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
export declare const pushAgent: AgentFunction<Record<string, any>, Record<string, any>, Array<any>>;
|
|
3
3
|
declare const pushAgentInfo: {
|
|
4
4
|
name: string;
|
|
5
5
|
agent: AgentFunction<Record<string, any>, Record<string, any>, any[]>;
|
|
6
6
|
mock: AgentFunction<Record<string, any>, Record<string, any>, any[]>;
|
|
7
|
-
samples: {
|
|
7
|
+
samples: ({
|
|
8
8
|
inputs: (number | number[])[];
|
|
9
9
|
params: {};
|
|
10
10
|
result: number[];
|
|
11
|
-
}
|
|
11
|
+
} | {
|
|
12
|
+
inputs: ({
|
|
13
|
+
apple: number;
|
|
14
|
+
}[] | {
|
|
15
|
+
lemon: number;
|
|
16
|
+
})[];
|
|
17
|
+
params: {};
|
|
18
|
+
result: ({
|
|
19
|
+
apple: number;
|
|
20
|
+
lemon?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
lemon: number;
|
|
23
|
+
apple?: undefined;
|
|
24
|
+
})[];
|
|
25
|
+
})[];
|
|
12
26
|
description: string;
|
|
13
27
|
category: never[];
|
|
14
28
|
author: string;
|
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.pushAgent = void 0;
|
|
4
4
|
const pushAgent = async ({ inputs }) => {
|
|
5
5
|
const array = inputs[0].map((item) => item); // shallow copy
|
|
6
|
-
|
|
6
|
+
inputs.forEach((input, index) => {
|
|
7
|
+
if (index > 0) {
|
|
8
|
+
array.push(input);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
7
11
|
return array;
|
|
8
12
|
};
|
|
9
13
|
exports.pushAgent = pushAgent;
|
|
@@ -17,6 +21,16 @@ const pushAgentInfo = {
|
|
|
17
21
|
params: {},
|
|
18
22
|
result: [1, 2, 3],
|
|
19
23
|
},
|
|
24
|
+
{
|
|
25
|
+
inputs: [[1, 2], 3, 4, 5],
|
|
26
|
+
params: {},
|
|
27
|
+
result: [1, 2, 3, 4, 5],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
inputs: [[{ apple: 1 }], { lemon: 2 }],
|
|
31
|
+
params: {},
|
|
32
|
+
result: [{ apple: 1 }, { lemon: 2 }],
|
|
33
|
+
},
|
|
20
34
|
],
|
|
21
35
|
description: "push Agent",
|
|
22
36
|
category: [],
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
export declare const propertyFilterAgent: AgentFunction<{
|
|
3
3
|
include?: Array<string>;
|
|
4
4
|
exclude?: Array<string>;
|
|
5
5
|
alter?: Record<string, Record<string, string>>;
|
|
6
|
-
inject?:
|
|
6
|
+
inject?: Array<Record<string, any>>;
|
|
7
|
+
swap?: Record<string, string>;
|
|
7
8
|
}>;
|
|
8
9
|
declare const propertyFilterAgentInfo: {
|
|
9
10
|
name: string;
|
|
@@ -11,13 +12,15 @@ declare const propertyFilterAgentInfo: {
|
|
|
11
12
|
include?: string[] | undefined;
|
|
12
13
|
exclude?: string[] | undefined;
|
|
13
14
|
alter?: Record<string, Record<string, string>> | undefined;
|
|
14
|
-
inject?: Record<string,
|
|
15
|
+
inject?: Record<string, any>[] | undefined;
|
|
16
|
+
swap?: Record<string, string> | undefined;
|
|
15
17
|
}>;
|
|
16
18
|
mock: AgentFunction<{
|
|
17
19
|
include?: string[] | undefined;
|
|
18
20
|
exclude?: string[] | undefined;
|
|
19
21
|
alter?: Record<string, Record<string, string>> | undefined;
|
|
20
|
-
inject?: Record<string,
|
|
22
|
+
inject?: Record<string, any>[] | undefined;
|
|
23
|
+
swap?: Record<string, string> | undefined;
|
|
21
24
|
}>;
|
|
22
25
|
samples: ({
|
|
23
26
|
inputs: (string | {
|
|
@@ -32,6 +35,7 @@ declare const propertyFilterAgentInfo: {
|
|
|
32
35
|
exclude?: undefined;
|
|
33
36
|
alter?: undefined;
|
|
34
37
|
inject?: undefined;
|
|
38
|
+
swap?: undefined;
|
|
35
39
|
};
|
|
36
40
|
result: {
|
|
37
41
|
color: string;
|
|
@@ -50,6 +54,7 @@ declare const propertyFilterAgentInfo: {
|
|
|
50
54
|
exclude?: undefined;
|
|
51
55
|
alter?: undefined;
|
|
52
56
|
inject?: undefined;
|
|
57
|
+
swap?: undefined;
|
|
53
58
|
};
|
|
54
59
|
result: {
|
|
55
60
|
color: string;
|
|
@@ -68,6 +73,7 @@ declare const propertyFilterAgentInfo: {
|
|
|
68
73
|
include?: undefined;
|
|
69
74
|
alter?: undefined;
|
|
70
75
|
inject?: undefined;
|
|
76
|
+
swap?: undefined;
|
|
71
77
|
};
|
|
72
78
|
result: {
|
|
73
79
|
type: string;
|
|
@@ -92,6 +98,7 @@ declare const propertyFilterAgentInfo: {
|
|
|
92
98
|
include?: undefined;
|
|
93
99
|
exclude?: undefined;
|
|
94
100
|
inject?: undefined;
|
|
101
|
+
swap?: undefined;
|
|
95
102
|
};
|
|
96
103
|
result: {
|
|
97
104
|
color: string;
|
|
@@ -110,14 +117,13 @@ declare const propertyFilterAgentInfo: {
|
|
|
110
117
|
}[])[];
|
|
111
118
|
params: {
|
|
112
119
|
inject: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
117
|
-
};
|
|
120
|
+
propId: string;
|
|
121
|
+
from: number;
|
|
122
|
+
}[];
|
|
118
123
|
include?: undefined;
|
|
119
124
|
exclude?: undefined;
|
|
120
125
|
alter?: undefined;
|
|
126
|
+
swap?: undefined;
|
|
121
127
|
};
|
|
122
128
|
result: {
|
|
123
129
|
color: string;
|
|
@@ -136,14 +142,38 @@ declare const propertyFilterAgentInfo: {
|
|
|
136
142
|
}[])[];
|
|
137
143
|
params: {
|
|
138
144
|
inject: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
propId: string;
|
|
146
|
+
from: number;
|
|
147
|
+
index: number;
|
|
148
|
+
}[];
|
|
149
|
+
include?: undefined;
|
|
150
|
+
exclude?: undefined;
|
|
151
|
+
alter?: undefined;
|
|
152
|
+
swap?: undefined;
|
|
153
|
+
};
|
|
154
|
+
result: {
|
|
155
|
+
color: string;
|
|
156
|
+
model: string;
|
|
157
|
+
type: string;
|
|
158
|
+
maker: string;
|
|
159
|
+
range: number;
|
|
160
|
+
}[];
|
|
161
|
+
} | {
|
|
162
|
+
inputs: (string | {
|
|
163
|
+
color: string;
|
|
164
|
+
model: string;
|
|
165
|
+
type: string;
|
|
166
|
+
maker: string;
|
|
167
|
+
range: number;
|
|
168
|
+
}[])[];
|
|
169
|
+
params: {
|
|
170
|
+
swap: {
|
|
171
|
+
maker: string;
|
|
143
172
|
};
|
|
144
173
|
include?: undefined;
|
|
145
174
|
exclude?: undefined;
|
|
146
175
|
alter?: undefined;
|
|
176
|
+
inject?: undefined;
|
|
147
177
|
};
|
|
148
178
|
result: {
|
|
149
179
|
color: string;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.propertyFilterAgent = void 0;
|
|
4
|
-
const applyFilter = (input, index, inputs, include, exclude, alter, inject) => {
|
|
4
|
+
const applyFilter = (input, index, inputs, include, exclude, alter, inject, swap) => {
|
|
5
5
|
const propIds = include ? include : Object.keys(input);
|
|
6
6
|
const excludeSet = new Set(exclude ?? []);
|
|
7
|
-
|
|
7
|
+
const result = propIds.reduce((tmp, propId) => {
|
|
8
8
|
if (!excludeSet.has(propId)) {
|
|
9
|
-
const injection = inject && inject[propId];
|
|
10
9
|
const mapping = alter && alter[propId];
|
|
11
|
-
if (
|
|
12
|
-
tmp[propId] = inputs[injection.from];
|
|
13
|
-
}
|
|
14
|
-
else if (mapping && mapping[input[propId]]) {
|
|
10
|
+
if (mapping && mapping[input[propId]]) {
|
|
15
11
|
tmp[propId] = mapping[input[propId]];
|
|
16
12
|
}
|
|
17
13
|
else {
|
|
@@ -20,14 +16,29 @@ const applyFilter = (input, index, inputs, include, exclude, alter, inject) => {
|
|
|
20
16
|
}
|
|
21
17
|
return tmp;
|
|
22
18
|
}, {});
|
|
19
|
+
if (inject) {
|
|
20
|
+
inject.forEach((item) => {
|
|
21
|
+
if (item.index === undefined || item.index === index) {
|
|
22
|
+
result[item.propId] = inputs[item.from];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (swap) {
|
|
27
|
+
Object.keys(swap).forEach((key) => {
|
|
28
|
+
const tmp = result[key];
|
|
29
|
+
result[key] = result[swap[key]];
|
|
30
|
+
result[swap[key]] = tmp;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
23
34
|
};
|
|
24
35
|
const propertyFilterAgent = async ({ inputs, params }) => {
|
|
25
36
|
const [input] = inputs;
|
|
26
|
-
const { include, exclude, alter, inject } = params;
|
|
37
|
+
const { include, exclude, alter, inject, swap } = params;
|
|
27
38
|
if (Array.isArray(input)) {
|
|
28
|
-
return input.map((item, index) => applyFilter(item, index, inputs, include, exclude, alter, inject));
|
|
39
|
+
return input.map((item, index) => applyFilter(item, index, inputs, include, exclude, alter, inject, swap));
|
|
29
40
|
}
|
|
30
|
-
return applyFilter(input, 0, inputs, include, exclude, alter);
|
|
41
|
+
return applyFilter(input, 0, inputs, include, exclude, alter, inject, swap);
|
|
31
42
|
};
|
|
32
43
|
exports.propertyFilterAgent = propertyFilterAgent;
|
|
33
44
|
const testInputs = [
|
|
@@ -73,7 +84,7 @@ const propertyFilterAgentInfo = {
|
|
|
73
84
|
},
|
|
74
85
|
{
|
|
75
86
|
inputs: testInputs,
|
|
76
|
-
params: { inject: {
|
|
87
|
+
params: { inject: [{ propId: "maker", from: 1 }] },
|
|
77
88
|
result: [
|
|
78
89
|
{ color: "red", model: "Model 3", type: "EV", maker: "Tesla Motors", range: 300 },
|
|
79
90
|
{ color: "blue", model: "Model Y", type: "EV", maker: "Tesla Motors", range: 400 },
|
|
@@ -81,12 +92,20 @@ const propertyFilterAgentInfo = {
|
|
|
81
92
|
},
|
|
82
93
|
{
|
|
83
94
|
inputs: testInputs,
|
|
84
|
-
params: { inject: {
|
|
95
|
+
params: { inject: [{ propId: "maker", from: 1, index: 0 }] },
|
|
85
96
|
result: [
|
|
86
97
|
{ color: "red", model: "Model 3", type: "EV", maker: "Tesla Motors", range: 300 },
|
|
87
98
|
{ color: "blue", model: "Model Y", type: "EV", maker: "Tesla", range: 400 },
|
|
88
99
|
],
|
|
89
100
|
},
|
|
101
|
+
{
|
|
102
|
+
inputs: testInputs,
|
|
103
|
+
params: { swap: { maker: "model" } },
|
|
104
|
+
result: [
|
|
105
|
+
{ color: "red", model: "Tesla", type: "EV", maker: "Model 3", range: 300 },
|
|
106
|
+
{ color: "blue", model: "Tesla", type: "EV", maker: "Model Y", range: 400 },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
90
109
|
],
|
|
91
110
|
description: "Filter properties based on property name either with 'include' or 'exclude'",
|
|
92
111
|
category: ["data"],
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
export declare const mapAgent: AgentFunction<{
|
|
3
|
-
|
|
3
|
+
namedInputs?: Array<string>;
|
|
4
4
|
limit?: number;
|
|
5
5
|
}, Record<string, Array<any>>, any>;
|
|
6
6
|
declare const mapAgentInfo: {
|
|
7
7
|
name: string;
|
|
8
8
|
agent: AgentFunction<{
|
|
9
|
-
|
|
9
|
+
namedInputs?: string[] | undefined;
|
|
10
10
|
limit?: number | undefined;
|
|
11
11
|
}, Record<string, any[]>, any>;
|
|
12
12
|
mock: AgentFunction<{
|
|
13
|
-
|
|
13
|
+
namedInputs?: string[] | undefined;
|
|
14
14
|
limit?: number | undefined;
|
|
15
15
|
}, Record<string, any[]>, any>;
|
|
16
16
|
samples: never[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapAgent = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../../index");
|
|
5
5
|
const utils_1 = require("../../utils/utils");
|
|
6
6
|
const nested_agent_1 = require("./nested_agent");
|
|
7
7
|
const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData, agentFilters }) => {
|
|
@@ -14,20 +14,20 @@ const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData, a
|
|
|
14
14
|
if (params.limit && params.limit < input.length) {
|
|
15
15
|
input.length = params.limit; // trim
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const namedInputs = params.namedInputs ??
|
|
18
18
|
inputs.map((__input, index) => {
|
|
19
19
|
return `$${index}`;
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
namedInputs.forEach((nodeId) => {
|
|
22
22
|
if (nestedGraphData.nodes[nodeId] === undefined) {
|
|
23
23
|
// If the input node does not exist, automatically create a static node
|
|
24
24
|
nestedGraphData.nodes[nodeId] = { value: {} };
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
const graphs = input.map((data) => {
|
|
28
|
-
const graphAI = new
|
|
28
|
+
const graphAI = new index_1.GraphAI(nestedGraphData, agents || {}, { taskManager, agentFilters: agentFilters || [] });
|
|
29
29
|
// Only the first input will be mapped
|
|
30
|
-
|
|
30
|
+
namedInputs.forEach((injectToNodeId, index) => {
|
|
31
31
|
graphAI.injectValue(injectToNodeId, index === 0 ? data : inputs[index], "__mapAgent_inputs__");
|
|
32
32
|
});
|
|
33
33
|
return graphAI;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
import { GraphData } from "../../type";
|
|
3
3
|
export declare const getNestedGraphData: (graphData: GraphData | string | undefined, inputs: Array<any>) => GraphData;
|
|
4
4
|
export declare const nestedAgent: AgentFunction<{
|
|
5
|
-
|
|
5
|
+
namedInputs?: Array<string>;
|
|
6
6
|
}>;
|
|
7
7
|
declare const nestedAgentInfo: {
|
|
8
8
|
name: string;
|
|
9
9
|
agent: AgentFunction<{
|
|
10
|
-
|
|
10
|
+
namedInputs?: string[] | undefined;
|
|
11
11
|
}>;
|
|
12
12
|
mock: AgentFunction<{
|
|
13
|
-
|
|
13
|
+
namedInputs?: string[] | undefined;
|
|
14
14
|
}>;
|
|
15
15
|
samples: never[];
|
|
16
16
|
description: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nestedAgent = exports.getNestedGraphData = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../../index");
|
|
5
5
|
const utils_1 = require("../../utils/utils");
|
|
6
6
|
// This function allows us to use one of inputs as the graph data for this nested agent,
|
|
7
7
|
// which is equivalent to "eval" of JavaScript.
|
|
@@ -27,8 +27,8 @@ const nestedAgent = async ({ params, inputs, agents, log, taskManager, graphData
|
|
|
27
27
|
(0, utils_1.assert)(status.concurrency > status.running, `nestedAgent: Concurrency is too low: ${status.concurrency}`);
|
|
28
28
|
}
|
|
29
29
|
const nestedGraphData = (0, exports.getNestedGraphData)(graphData, inputs);
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const namedInputs = params.namedInputs ?? inputs.map((__input, index) => `$${index}`);
|
|
31
|
+
namedInputs.forEach((nodeId, index) => {
|
|
32
32
|
if (nestedGraphData.nodes[nodeId] === undefined) {
|
|
33
33
|
// If the input node does not exist, automatically create a static node
|
|
34
34
|
nestedGraphData.nodes[nodeId] = { value: inputs[index] };
|
|
@@ -38,7 +38,7 @@ const nestedAgent = async ({ params, inputs, agents, log, taskManager, graphData
|
|
|
38
38
|
nestedGraphData.nodes[nodeId]["value"] = inputs[index];
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
const graphAI = new
|
|
41
|
+
const graphAI = new index_1.GraphAI(nestedGraphData, agents || {}, { taskManager, agentFilters });
|
|
42
42
|
const results = await graphAI.run(false);
|
|
43
43
|
log?.push(...graphAI.transactionLogs());
|
|
44
44
|
return results;
|
|
@@ -7,6 +7,7 @@ export * from "./data_agents";
|
|
|
7
7
|
export * from "./sleeper_agents";
|
|
8
8
|
export * from "./llm_agents";
|
|
9
9
|
export * from "./service_agents";
|
|
10
|
+
export * from "./input_agents";
|
|
10
11
|
import functionAgent from "./function_agent";
|
|
11
12
|
import stringEmbeddingsAgent from "./embedding_agent";
|
|
12
13
|
import tokenBoundStringsAgent from "./token_agent";
|
|
@@ -28,6 +28,7 @@ __exportStar(require("./data_agents"), exports);
|
|
|
28
28
|
__exportStar(require("./sleeper_agents"), exports);
|
|
29
29
|
__exportStar(require("./llm_agents"), exports);
|
|
30
30
|
__exportStar(require("./service_agents"), exports);
|
|
31
|
+
__exportStar(require("./input_agents"), exports);
|
|
31
32
|
// TODO sub folder
|
|
32
33
|
const function_agent_1 = __importDefault(require("./function_agent"));
|
|
33
34
|
exports.functionAgent = function_agent_1.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.textInputAgent = void 0;
|
|
7
|
+
const text_input_agent_1 = __importDefault(require("../../experimental_agents/input_agents/text_input_agent"));
|
|
8
|
+
exports.textInputAgent = text_input_agent_1.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.textInputAgent = void 0;
|
|
7
|
+
const text_input_agent_1 = __importDefault(require("../../experimental_agents/input_agents/text_input_agent"));
|
|
8
|
+
exports.textInputAgent = text_input_agent_1.default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
|
+
export declare const textInputAgent: AgentFunction<{
|
|
3
|
+
message?: string;
|
|
4
|
+
}, string | {
|
|
5
|
+
[x: string]: string;
|
|
6
|
+
}>;
|
|
7
|
+
declare const textInputAgentInfo: {
|
|
8
|
+
name: string;
|
|
9
|
+
agent: AgentFunction<{
|
|
10
|
+
message?: string | undefined;
|
|
11
|
+
}, string | {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
}>;
|
|
14
|
+
mock: AgentFunction<{
|
|
15
|
+
message?: string | undefined;
|
|
16
|
+
}, string | {
|
|
17
|
+
[x: string]: string;
|
|
18
|
+
}>;
|
|
19
|
+
samples: never[];
|
|
20
|
+
description: string;
|
|
21
|
+
category: string[];
|
|
22
|
+
author: string;
|
|
23
|
+
repository: string;
|
|
24
|
+
license: string;
|
|
25
|
+
};
|
|
26
|
+
export default textInputAgentInfo;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.textInputAgent = void 0;
|
|
7
|
+
const input_1 = __importDefault(require("@inquirer/input"));
|
|
8
|
+
const textInputAgent = async ({ params }) => {
|
|
9
|
+
return await (0, input_1.default)({ message: params.message ?? "Enter" });
|
|
10
|
+
};
|
|
11
|
+
exports.textInputAgent = textInputAgent;
|
|
12
|
+
const textInputAgentInfo = {
|
|
13
|
+
name: "textInputAgent",
|
|
14
|
+
agent: exports.textInputAgent,
|
|
15
|
+
mock: exports.textInputAgent,
|
|
16
|
+
samples: [],
|
|
17
|
+
description: "Text Input Agent",
|
|
18
|
+
category: ["array"],
|
|
19
|
+
author: "Receptron team",
|
|
20
|
+
repository: "https://github.com/receptron/graphai",
|
|
21
|
+
license: "MIT",
|
|
22
|
+
};
|
|
23
|
+
exports.default = textInputAgentInfo;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
import { Groq } from "groq-sdk";
|
|
3
3
|
export declare const groqAgent: AgentFunction<{
|
|
4
4
|
model: string;
|
|
5
5
|
query?: string;
|
|
6
6
|
system?: string;
|
|
7
7
|
verbose?: boolean;
|
|
8
|
-
tools?:
|
|
8
|
+
tools?: Groq.Chat.CompletionCreateParams.Tool[];
|
|
9
9
|
temperature?: number;
|
|
10
10
|
max_tokens?: number;
|
|
11
|
-
tool_choice?:
|
|
12
|
-
|
|
11
|
+
tool_choice?: Groq.Chat.CompletionCreateParams.ToolChoice;
|
|
12
|
+
isStreaming?: boolean;
|
|
13
|
+
}, any, string | Array<Groq.Chat.CompletionCreateParams.Message>>;
|
|
13
14
|
declare const groqAgentInfo: {
|
|
14
15
|
name: string;
|
|
15
16
|
agent: AgentFunction<{
|
|
@@ -17,21 +18,23 @@ declare const groqAgentInfo: {
|
|
|
17
18
|
query?: string | undefined;
|
|
18
19
|
system?: string | undefined;
|
|
19
20
|
verbose?: boolean | undefined;
|
|
20
|
-
tools?:
|
|
21
|
+
tools?: Groq.Chat.Completions.CompletionCreateParams.Tool[] | undefined;
|
|
21
22
|
temperature?: number | undefined;
|
|
22
23
|
max_tokens?: number | undefined;
|
|
23
|
-
tool_choice?:
|
|
24
|
-
|
|
24
|
+
tool_choice?: Groq.Chat.Completions.CompletionCreateParams.ToolChoice | undefined;
|
|
25
|
+
isStreaming?: boolean | undefined;
|
|
26
|
+
}, any, string | Groq.Chat.Completions.CompletionCreateParams.Message[]>;
|
|
25
27
|
mock: AgentFunction<{
|
|
26
28
|
model: string;
|
|
27
29
|
query?: string | undefined;
|
|
28
30
|
system?: string | undefined;
|
|
29
31
|
verbose?: boolean | undefined;
|
|
30
|
-
tools?:
|
|
32
|
+
tools?: Groq.Chat.Completions.CompletionCreateParams.Tool[] | undefined;
|
|
31
33
|
temperature?: number | undefined;
|
|
32
34
|
max_tokens?: number | undefined;
|
|
33
|
-
tool_choice?:
|
|
34
|
-
|
|
35
|
+
tool_choice?: Groq.Chat.Completions.CompletionCreateParams.ToolChoice | undefined;
|
|
36
|
+
isStreaming?: boolean | undefined;
|
|
37
|
+
}, any, string | Groq.Chat.Completions.CompletionCreateParams.Message[]>;
|
|
35
38
|
samples: never[];
|
|
36
39
|
description: string;
|
|
37
40
|
category: string[];
|