graphai 0.1.2 → 0.2.1
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 +107 -78
- package/lib/experimental_agents/array_agents/packages.d.ts +4 -0
- package/lib/experimental_agents/array_agents/packages.js +12 -0
- package/lib/experimental_agents/array_agents/pop_agent.d.ts +27 -1
- package/lib/experimental_agents/array_agents/pop_agent.js +41 -6
- package/lib/experimental_agents/array_agents/push_agent.d.ts +17 -1
- package/lib/experimental_agents/array_agents/push_agent.js +20 -7
- package/lib/experimental_agents/array_agents/shift_agent.d.ts +27 -1
- package/lib/experimental_agents/array_agents/shift_agent.js +30 -6
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.d.ts +57 -2
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.js +13 -1
- package/lib/experimental_agents/data_agents/data_sum_template_agent.d.ts +1 -0
- package/lib/experimental_agents/data_agents/data_sum_template_agent.js +1 -0
- package/lib/experimental_agents/data_agents/index.d.ts +1 -0
- package/lib/experimental_agents/data_agents/index.js +3 -1
- package/lib/experimental_agents/data_agents/packages.d.ts +5 -0
- package/lib/experimental_agents/data_agents/packages.js +14 -0
- package/lib/experimental_agents/data_agents/property_filter_agent.d.ts +61 -0
- package/lib/experimental_agents/data_agents/property_filter_agent.js +40 -0
- package/lib/experimental_agents/data_agents/total_agent.d.ts +1 -0
- package/lib/experimental_agents/data_agents/total_agent.js +1 -0
- package/lib/experimental_agents/embedding_agent.d.ts +17 -3
- package/lib/experimental_agents/embedding_agent.js +13 -1
- package/lib/experimental_agents/function_agent.d.ts +42 -0
- package/lib/experimental_agents/function_agent.js +40 -0
- package/lib/experimental_agents/graph_agents/index.d.ts +2 -0
- package/lib/experimental_agents/graph_agents/index.js +7 -0
- package/lib/experimental_agents/graph_agents/map_agent.d.ts +20 -0
- package/lib/experimental_agents/{map_agent.js → graph_agents/map_agent.js} +31 -10
- package/lib/experimental_agents/graph_agents/nested_agent.d.ts +22 -0
- package/lib/experimental_agents/graph_agents/nested_agent.js +70 -0
- package/lib/experimental_agents/graph_agents/packages.d.ts +3 -0
- package/lib/experimental_agents/graph_agents/packages.js +10 -0
- package/lib/experimental_agents/index.d.ts +5 -5
- package/lib/experimental_agents/index.js +5 -5
- package/lib/experimental_agents/llm_agents/groq_agent.d.ts +26 -0
- package/lib/experimental_agents/llm_agents/groq_agent.js +39 -0
- package/lib/experimental_agents/llm_agents/index.d.ts +2 -0
- package/lib/experimental_agents/llm_agents/index.js +18 -0
- package/lib/experimental_agents/llm_agents/packages.d.ts +3 -0
- package/lib/experimental_agents/llm_agents/packages.js +10 -0
- package/lib/experimental_agents/llm_agents/slashgpt_agent.d.ts +27 -0
- package/lib/experimental_agents/{slashgpt_agent.js → llm_agents/slashgpt_agent.js} +13 -10
- package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +17 -3
- package/lib/experimental_agents/matrix_agents/dot_product_agent.js +26 -1
- package/lib/experimental_agents/matrix_agents/packages.d.ts +3 -0
- package/lib/experimental_agents/matrix_agents/packages.js +10 -0
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.d.ts +17 -3
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.js +13 -1
- package/lib/experimental_agents/packages.d.ts +12 -0
- package/lib/experimental_agents/packages.js +34 -0
- package/lib/experimental_agents/sleeper_agents/packages.d.ts +3 -0
- package/lib/experimental_agents/sleeper_agents/packages.js +10 -0
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.d.ts +18 -0
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.js +12 -0
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.d.ts +20 -0
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.js +13 -1
- package/lib/experimental_agents/string_agents/packages.d.ts +3 -0
- package/lib/experimental_agents/string_agents/packages.js +10 -0
- package/lib/experimental_agents/string_agents/string_splitter_agent.d.ts +1 -0
- package/lib/experimental_agents/string_agents/string_splitter_agent.js +1 -0
- package/lib/experimental_agents/string_agents/string_template_agent.d.ts +5 -6
- package/lib/experimental_agents/string_agents/string_template_agent.js +3 -2
- package/lib/experimental_agents/test_agents/bypass_agent.d.ts +7 -1
- package/lib/experimental_agents/test_agents/bypass_agent.js +53 -4
- package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +6 -1
- package/lib/experimental_agents/test_agents/copy2array_agent.js +32 -2
- package/lib/experimental_agents/test_agents/copy_message_agent.d.ts +9 -1
- package/lib/experimental_agents/test_agents/copy_message_agent.js +19 -0
- package/lib/experimental_agents/test_agents/counting_agent.d.ts +8 -1
- package/lib/experimental_agents/test_agents/counting_agent.js +19 -0
- package/lib/experimental_agents/test_agents/echo_agent.d.ts +3 -0
- package/lib/experimental_agents/test_agents/echo_agent.js +13 -0
- package/lib/experimental_agents/test_agents/merge_node_id_agent.d.ts +3 -0
- package/lib/experimental_agents/test_agents/merge_node_id_agent.js +22 -0
- package/lib/experimental_agents/test_agents/packages.d.ts +7 -0
- package/lib/experimental_agents/test_agents/packages.js +18 -0
- package/lib/experimental_agents/token_agent.d.ts +20 -0
- package/lib/experimental_agents/token_agent.js +12 -0
- package/lib/graphai.d.ts +2 -1
- package/lib/graphai.js +13 -12
- package/lib/node.d.ts +1 -0
- package/lib/node.js +18 -11
- package/lib/transaction_log.js +1 -1
- package/lib/type.d.ts +8 -5
- package/lib/utils/test_agents.js +1 -0
- package/lib/utils/test_utils.js +15 -10
- package/lib/utils/utils.d.ts +4 -2
- package/lib/utils/utils.js +47 -5
- package/lib/validators/relation_validator.js +11 -6
- package/package.json +4 -2
- package/lib/experimental_agents/map_agent.d.ts +0 -4
- package/lib/experimental_agents/nested_agent.d.ts +0 -5
- package/lib/experimental_agents/nested_agent.js +0 -40
- package/lib/experimental_agents/slashgpt_agent.d.ts +0 -9
|
@@ -16,15 +16,18 @@ const slashGPTAgent = async ({ params, inputs, debugInfo: { verbose, nodeId } })
|
|
|
16
16
|
const contents = query.concat(inputs);
|
|
17
17
|
session.append_user_question(contents.join("\n"));
|
|
18
18
|
await session.call_loop(() => { });
|
|
19
|
-
|
|
20
|
-
if (params?.function_result) {
|
|
21
|
-
return session.history.messages().find((m) => m.role === "function_result");
|
|
22
|
-
}
|
|
23
|
-
return session.history.last_message();
|
|
24
|
-
})();
|
|
25
|
-
if (message === undefined) {
|
|
26
|
-
throw new Error("No message in the history");
|
|
27
|
-
}
|
|
28
|
-
return message;
|
|
19
|
+
return session.history.messages();
|
|
29
20
|
};
|
|
30
21
|
exports.slashGPTAgent = slashGPTAgent;
|
|
22
|
+
const slashGPTAgentInfo = {
|
|
23
|
+
name: "slashGPTAgent",
|
|
24
|
+
agent: exports.slashGPTAgent,
|
|
25
|
+
mock: exports.slashGPTAgent,
|
|
26
|
+
samples: [],
|
|
27
|
+
description: "Slash GPT Agent",
|
|
28
|
+
category: ["llm"],
|
|
29
|
+
author: "Receptron team",
|
|
30
|
+
repository: "https://github.com/receptron/graphai",
|
|
31
|
+
license: "MIT",
|
|
32
|
+
};
|
|
33
|
+
exports.default = slashGPTAgentInfo;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
|
-
export declare const dotProductAgent: AgentFunction<Record<
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare const dotProductAgent: AgentFunction<Record<never, never>, Array<number>, Array<Array<number>>>;
|
|
3
|
+
declare const dotProductAgentInfo: {
|
|
4
|
+
name: string;
|
|
5
|
+
agent: AgentFunction<Record<never, never>, number[], number[][]>;
|
|
6
|
+
mock: AgentFunction<Record<never, never>, number[], number[][]>;
|
|
7
|
+
samples: {
|
|
8
|
+
inputs: number[][][];
|
|
9
|
+
params: {};
|
|
10
|
+
result: number[];
|
|
11
|
+
}[];
|
|
12
|
+
description: string;
|
|
13
|
+
category: never[];
|
|
14
|
+
author: string;
|
|
15
|
+
repository: string;
|
|
16
|
+
license: string;
|
|
17
|
+
};
|
|
18
|
+
export default dotProductAgentInfo;
|
|
@@ -19,6 +19,31 @@ const dotProductAgent = async ({ inputs }) => {
|
|
|
19
19
|
return dotProduct + value * reference[index];
|
|
20
20
|
}, 0);
|
|
21
21
|
});
|
|
22
|
-
return
|
|
22
|
+
return contents;
|
|
23
23
|
};
|
|
24
24
|
exports.dotProductAgent = dotProductAgent;
|
|
25
|
+
const dotProductAgentInfo = {
|
|
26
|
+
name: "dotProductAgent",
|
|
27
|
+
agent: exports.dotProductAgent,
|
|
28
|
+
mock: exports.dotProductAgent,
|
|
29
|
+
samples: [
|
|
30
|
+
{
|
|
31
|
+
inputs: [
|
|
32
|
+
[
|
|
33
|
+
[1, 2],
|
|
34
|
+
[3, 4],
|
|
35
|
+
[5, 6],
|
|
36
|
+
],
|
|
37
|
+
[[3, 2]],
|
|
38
|
+
],
|
|
39
|
+
params: {},
|
|
40
|
+
result: [7, 17, 27],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
description: "dotProduct Agent",
|
|
44
|
+
category: [],
|
|
45
|
+
author: "Receptron team",
|
|
46
|
+
repository: "https://github.com/receptron/graphai",
|
|
47
|
+
license: "MIT",
|
|
48
|
+
};
|
|
49
|
+
exports.default = dotProductAgentInfo;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.sortByValuesAgent = exports.dotProductAgent = void 0;
|
|
7
|
+
const dot_product_agent_1 = __importDefault(require("../../experimental_agents/matrix_agents/dot_product_agent"));
|
|
8
|
+
exports.dotProductAgent = dot_product_agent_1.default;
|
|
9
|
+
const sort_by_values_agent_1 = __importDefault(require("../../experimental_agents/matrix_agents/sort_by_values_agent"));
|
|
10
|
+
exports.sortByValuesAgent = sort_by_values_agent_1.default;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
2
|
export declare const sortByValuesAgent: AgentFunction<{
|
|
3
3
|
assendant?: boolean;
|
|
4
|
-
},
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
}, Array<any>, Array<any>>;
|
|
5
|
+
declare const sortByValuesAgentInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
agent: AgentFunction<{
|
|
8
|
+
assendant?: boolean | undefined;
|
|
9
|
+
}, any[], any[]>;
|
|
10
|
+
mock: AgentFunction<{
|
|
11
|
+
assendant?: boolean | undefined;
|
|
12
|
+
}, any[], any[]>;
|
|
13
|
+
samples: never[];
|
|
14
|
+
description: string;
|
|
15
|
+
category: never[];
|
|
16
|
+
author: string;
|
|
17
|
+
repository: string;
|
|
18
|
+
license: string;
|
|
19
|
+
};
|
|
20
|
+
export default sortByValuesAgentInfo;
|
|
@@ -24,6 +24,18 @@ const sortByValuesAgent = async ({ params, inputs }) => {
|
|
|
24
24
|
.map((a) => {
|
|
25
25
|
return a.item;
|
|
26
26
|
});
|
|
27
|
-
return
|
|
27
|
+
return contents;
|
|
28
28
|
};
|
|
29
29
|
exports.sortByValuesAgent = sortByValuesAgent;
|
|
30
|
+
const sortByValuesAgentInfo = {
|
|
31
|
+
name: "sortByValuesAgent",
|
|
32
|
+
agent: exports.sortByValuesAgent,
|
|
33
|
+
mock: exports.sortByValuesAgent,
|
|
34
|
+
samples: [],
|
|
35
|
+
description: "sortByValues Agent",
|
|
36
|
+
category: [],
|
|
37
|
+
author: "Receptron team",
|
|
38
|
+
repository: "https://github.com/receptron/graphai",
|
|
39
|
+
license: "MIT",
|
|
40
|
+
};
|
|
41
|
+
exports.default = sortByValuesAgentInfo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./string_agents/packages";
|
|
2
|
+
export * from "./sleeper_agents/packages";
|
|
3
|
+
export * from "./data_agents/packages";
|
|
4
|
+
export * from "./array_agents/packages";
|
|
5
|
+
export * from "./matrix_agents/packages";
|
|
6
|
+
export * from "./test_agents/packages";
|
|
7
|
+
export * from "./graph_agents/packages";
|
|
8
|
+
export * from "./llm_agents/packages";
|
|
9
|
+
import stringEmbeddingsAgent from "./embedding_agent";
|
|
10
|
+
import tokenBoundStringsAgent from "./token_agent";
|
|
11
|
+
import functionAgentInfo from "./function_agent";
|
|
12
|
+
export { stringEmbeddingsAgent, tokenBoundStringsAgent, functionAgentInfo };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.functionAgentInfo = exports.tokenBoundStringsAgent = exports.stringEmbeddingsAgent = void 0;
|
|
21
|
+
__exportStar(require("./string_agents/packages"), exports);
|
|
22
|
+
__exportStar(require("./sleeper_agents/packages"), exports);
|
|
23
|
+
__exportStar(require("./data_agents/packages"), exports);
|
|
24
|
+
__exportStar(require("./array_agents/packages"), exports);
|
|
25
|
+
__exportStar(require("./matrix_agents/packages"), exports);
|
|
26
|
+
__exportStar(require("./test_agents/packages"), exports);
|
|
27
|
+
__exportStar(require("./graph_agents/packages"), exports);
|
|
28
|
+
__exportStar(require("./llm_agents/packages"), exports);
|
|
29
|
+
const embedding_agent_1 = __importDefault(require("./embedding_agent"));
|
|
30
|
+
exports.stringEmbeddingsAgent = embedding_agent_1.default;
|
|
31
|
+
const token_agent_1 = __importDefault(require("./token_agent"));
|
|
32
|
+
exports.tokenBoundStringsAgent = token_agent_1.default;
|
|
33
|
+
const function_agent_1 = __importDefault(require("./function_agent"));
|
|
34
|
+
exports.functionAgentInfo = function_agent_1.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.sleeperAgentDebug = exports.sleeperAgent = void 0;
|
|
7
|
+
const sleeper_agent_1 = __importDefault(require("../../experimental_agents/sleeper_agents/sleeper_agent"));
|
|
8
|
+
exports.sleeperAgent = sleeper_agent_1.default;
|
|
9
|
+
const sleeper_agent_debug_1 = __importDefault(require("../../experimental_agents/sleeper_agents/sleeper_agent_debug"));
|
|
10
|
+
exports.sleeperAgentDebug = sleeper_agent_debug_1.default;
|
|
@@ -3,3 +3,21 @@ export declare const sleeperAgent: AgentFunction<{
|
|
|
3
3
|
duration?: number;
|
|
4
4
|
value?: Record<string, any>;
|
|
5
5
|
}>;
|
|
6
|
+
declare const sleeperAgentInfo: {
|
|
7
|
+
name: string;
|
|
8
|
+
agent: AgentFunction<{
|
|
9
|
+
duration?: number | undefined;
|
|
10
|
+
value?: Record<string, any> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
mock: AgentFunction<{
|
|
13
|
+
duration?: number | undefined;
|
|
14
|
+
value?: Record<string, any> | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
samples: never[];
|
|
17
|
+
description: string;
|
|
18
|
+
category: never[];
|
|
19
|
+
author: string;
|
|
20
|
+
repository: string;
|
|
21
|
+
license: string;
|
|
22
|
+
};
|
|
23
|
+
export default sleeperAgentInfo;
|
|
@@ -14,3 +14,15 @@ const sleeperAgent = async (context) => {
|
|
|
14
14
|
}, params.value ?? {});
|
|
15
15
|
};
|
|
16
16
|
exports.sleeperAgent = sleeperAgent;
|
|
17
|
+
const sleeperAgentInfo = {
|
|
18
|
+
name: "sleeperAgent",
|
|
19
|
+
agent: exports.sleeperAgent,
|
|
20
|
+
mock: exports.sleeperAgent,
|
|
21
|
+
samples: [],
|
|
22
|
+
description: "sleeper Agent",
|
|
23
|
+
category: [],
|
|
24
|
+
author: "Receptron team",
|
|
25
|
+
repository: "https://github.com/receptron/graphai",
|
|
26
|
+
license: "MIT",
|
|
27
|
+
};
|
|
28
|
+
exports.default = sleeperAgentInfo;
|
|
@@ -4,3 +4,23 @@ export declare const sleeperAgentDebug: AgentFunction<{
|
|
|
4
4
|
value?: Record<string, any>;
|
|
5
5
|
fail?: boolean;
|
|
6
6
|
}>;
|
|
7
|
+
declare const sleeperAgentDebugInfo: {
|
|
8
|
+
name: string;
|
|
9
|
+
agent: AgentFunction<{
|
|
10
|
+
duration: number;
|
|
11
|
+
value?: Record<string, any> | undefined;
|
|
12
|
+
fail?: boolean | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
mock: AgentFunction<{
|
|
15
|
+
duration: number;
|
|
16
|
+
value?: Record<string, any> | undefined;
|
|
17
|
+
fail?: boolean | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
samples: never[];
|
|
20
|
+
description: string;
|
|
21
|
+
category: never[];
|
|
22
|
+
author: string;
|
|
23
|
+
repository: string;
|
|
24
|
+
license: string;
|
|
25
|
+
};
|
|
26
|
+
export default sleeperAgentDebugInfo;
|
|
@@ -10,10 +10,22 @@ const sleeperAgentDebug = async ({ params, inputs, debugInfo: { retry }, }) => {
|
|
|
10
10
|
await (0, utils_1.sleep)(params.duration / (retry + 1));
|
|
11
11
|
if (params.fail && retry < 2) {
|
|
12
12
|
// console.log("failed (intentional)", nodeId, retry);
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error(utils_1.strIntentionalError);
|
|
14
14
|
}
|
|
15
15
|
return inputs.reduce((result, input) => {
|
|
16
16
|
return (0, deepmerge_1.default)(result, input);
|
|
17
17
|
}, params.value ?? {});
|
|
18
18
|
};
|
|
19
19
|
exports.sleeperAgentDebug = sleeperAgentDebug;
|
|
20
|
+
const sleeperAgentDebugInfo = {
|
|
21
|
+
name: "sleeperAgentDebug",
|
|
22
|
+
agent: exports.sleeperAgentDebug,
|
|
23
|
+
mock: exports.sleeperAgentDebug,
|
|
24
|
+
samples: [],
|
|
25
|
+
description: "sleeper debug Agent",
|
|
26
|
+
category: [],
|
|
27
|
+
author: "Receptron team",
|
|
28
|
+
repository: "https://github.com/receptron/graphai",
|
|
29
|
+
license: "MIT",
|
|
30
|
+
};
|
|
31
|
+
exports.default = sleeperAgentDebugInfo;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.stringTemplateAgent = exports.stringSplitterAgent = void 0;
|
|
7
|
+
const string_splitter_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_splitter_agent"));
|
|
8
|
+
exports.stringSplitterAgent = string_splitter_agent_1.default;
|
|
9
|
+
const string_template_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_template_agent"));
|
|
10
|
+
exports.stringTemplateAgent = string_template_agent_1.default;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
2
|
export declare const stringTemplateAgent: AgentFunction<{
|
|
3
3
|
template: string;
|
|
4
|
-
},
|
|
4
|
+
}, string, string>;
|
|
5
5
|
declare const stringTemplateAgentInfo: {
|
|
6
6
|
name: string;
|
|
7
7
|
agent: AgentFunction<{
|
|
8
8
|
template: string;
|
|
9
|
-
}, string
|
|
9
|
+
}, string, string>;
|
|
10
10
|
mock: AgentFunction<{
|
|
11
11
|
template: string;
|
|
12
|
-
}, string
|
|
12
|
+
}, string, string>;
|
|
13
13
|
samples: {
|
|
14
14
|
inputs: string[];
|
|
15
15
|
params: {
|
|
16
16
|
template: string;
|
|
17
17
|
};
|
|
18
|
-
result:
|
|
19
|
-
content: string;
|
|
20
|
-
};
|
|
18
|
+
result: string;
|
|
21
19
|
}[];
|
|
22
20
|
description: string;
|
|
21
|
+
category: never[];
|
|
23
22
|
author: string;
|
|
24
23
|
repository: string;
|
|
25
24
|
license: string;
|
|
@@ -7,12 +7,12 @@ const stringTemplateAgent = async ({ params, inputs }) => {
|
|
|
7
7
|
const content = inputs.reduce((template, input, index) => {
|
|
8
8
|
return template.replace("${" + index + "}", input);
|
|
9
9
|
}, params.template);
|
|
10
|
-
return
|
|
10
|
+
return content;
|
|
11
11
|
};
|
|
12
12
|
exports.stringTemplateAgent = stringTemplateAgent;
|
|
13
13
|
const sampleInput = ["hello", "test"];
|
|
14
14
|
const sampleParams = { template: "${0}: ${1}" };
|
|
15
|
-
const sampleResult =
|
|
15
|
+
const sampleResult = "hello: test";
|
|
16
16
|
// for test and document
|
|
17
17
|
const stringTemplateAgentInfo = {
|
|
18
18
|
name: "stringTemplateAgent",
|
|
@@ -26,6 +26,7 @@ const stringTemplateAgentInfo = {
|
|
|
26
26
|
},
|
|
27
27
|
],
|
|
28
28
|
description: "Template agent",
|
|
29
|
+
category: [],
|
|
29
30
|
author: "Satoshi Nakajima",
|
|
30
31
|
repository: "https://github.com/receptron/graphai",
|
|
31
32
|
license: "MIT",
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
|
-
|
|
2
|
+
import { AgentFunctionInfo } from "../../type";
|
|
3
|
+
export declare const bypassAgent: AgentFunction<{
|
|
4
|
+
flat?: number;
|
|
5
|
+
firstElement?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
declare const bypassAgentInfo: AgentFunctionInfo;
|
|
8
|
+
export default bypassAgentInfo;
|
|
@@ -1,10 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bypassAgent = void 0;
|
|
4
|
-
const bypassAgent = async (
|
|
5
|
-
if (
|
|
6
|
-
return
|
|
4
|
+
const bypassAgent = async ({ params, inputs }) => {
|
|
5
|
+
if (params && params.firstElement) {
|
|
6
|
+
return inputs[0];
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
if (params && params.flat) {
|
|
9
|
+
return inputs.flat(params.flat || 1);
|
|
10
|
+
}
|
|
11
|
+
return inputs;
|
|
9
12
|
};
|
|
10
13
|
exports.bypassAgent = bypassAgent;
|
|
14
|
+
// for test and document
|
|
15
|
+
const bypassAgentInfo = {
|
|
16
|
+
name: "bypassAgent",
|
|
17
|
+
agent: exports.bypassAgent,
|
|
18
|
+
mock: exports.bypassAgent,
|
|
19
|
+
samples: [
|
|
20
|
+
{
|
|
21
|
+
inputs: [{ a: "123" }],
|
|
22
|
+
params: {},
|
|
23
|
+
result: [{ a: "123" }],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
inputs: [
|
|
27
|
+
[{ a: "123" }, { b: "abc" }],
|
|
28
|
+
[{ c: "987" }, { d: "xyz" }],
|
|
29
|
+
],
|
|
30
|
+
params: {},
|
|
31
|
+
result: [
|
|
32
|
+
[{ a: "123" }, { b: "abc" }],
|
|
33
|
+
[{ c: "987" }, { d: "xyz" }],
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
inputs: [
|
|
38
|
+
[{ a: "123" }, { b: "abc" }],
|
|
39
|
+
[{ c: "987" }, { d: "xyz" }],
|
|
40
|
+
],
|
|
41
|
+
params: { firstElement: true },
|
|
42
|
+
result: [{ a: "123" }, { b: "abc" }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
inputs: [
|
|
46
|
+
[{ a: "123" }, { b: "abc" }],
|
|
47
|
+
[{ c: "987" }, { d: "xyz" }],
|
|
48
|
+
],
|
|
49
|
+
params: { flat: 1 },
|
|
50
|
+
result: [{ a: "123" }, { b: "abc" }, { c: "987" }, { d: "xyz" }],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
description: "bypass agent",
|
|
54
|
+
category: [],
|
|
55
|
+
author: "Receptron team",
|
|
56
|
+
repository: "https://github.com/receptron/graphai",
|
|
57
|
+
license: "MIT",
|
|
58
|
+
};
|
|
59
|
+
exports.default = bypassAgentInfo;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
|
-
|
|
2
|
+
import { AgentFunctionInfo } from "../../type";
|
|
3
|
+
export declare const copy2ArrayAgent: AgentFunction<{
|
|
4
|
+
count: number;
|
|
5
|
+
}>;
|
|
6
|
+
declare const copy2ArrayAgentInfo: AgentFunctionInfo;
|
|
7
|
+
export default copy2ArrayAgentInfo;
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.copy2ArrayAgent = void 0;
|
|
4
|
-
const copy2ArrayAgent = async ({ inputs }) => {
|
|
5
|
-
return new Array(
|
|
4
|
+
const copy2ArrayAgent = async ({ inputs, params }) => {
|
|
5
|
+
return new Array(params.count).fill(undefined).map(() => {
|
|
6
6
|
return inputs[0];
|
|
7
7
|
});
|
|
8
8
|
};
|
|
9
9
|
exports.copy2ArrayAgent = copy2ArrayAgent;
|
|
10
|
+
// for test and document
|
|
11
|
+
const copy2ArrayAgentInfo = {
|
|
12
|
+
name: "copy2ArrayAgent",
|
|
13
|
+
agent: exports.copy2ArrayAgent,
|
|
14
|
+
mock: exports.copy2ArrayAgent,
|
|
15
|
+
samples: [
|
|
16
|
+
{
|
|
17
|
+
inputs: [{ message: "hello" }],
|
|
18
|
+
params: { count: 10 },
|
|
19
|
+
result: [
|
|
20
|
+
{ message: "hello" },
|
|
21
|
+
{ message: "hello" },
|
|
22
|
+
{ message: "hello" },
|
|
23
|
+
{ message: "hello" },
|
|
24
|
+
{ message: "hello" },
|
|
25
|
+
{ message: "hello" },
|
|
26
|
+
{ message: "hello" },
|
|
27
|
+
{ message: "hello" },
|
|
28
|
+
{ message: "hello" },
|
|
29
|
+
{ message: "hello" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
description: "Copy2Array agent",
|
|
34
|
+
category: [],
|
|
35
|
+
author: "Receptron team",
|
|
36
|
+
repository: "https://github.com/receptron/graphai",
|
|
37
|
+
license: "MIT",
|
|
38
|
+
};
|
|
39
|
+
exports.default = copy2ArrayAgentInfo;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
|
-
|
|
2
|
+
import { AgentFunctionInfo } from "../../type";
|
|
3
|
+
export declare const copyMessageAgent: AgentFunction<{
|
|
4
|
+
count: number;
|
|
5
|
+
message: string;
|
|
6
|
+
}, {
|
|
7
|
+
messages: string[];
|
|
8
|
+
}>;
|
|
9
|
+
declare const copyMessageAgentInfo: AgentFunctionInfo;
|
|
10
|
+
export default copyMessageAgentInfo;
|
|
@@ -9,3 +9,22 @@ const copyMessageAgent = async ({ params }) => {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
exports.copyMessageAgent = copyMessageAgent;
|
|
12
|
+
// for test and document
|
|
13
|
+
const copyMessageAgentInfo = {
|
|
14
|
+
name: "copyMessageAgent",
|
|
15
|
+
agent: exports.copyMessageAgent,
|
|
16
|
+
mock: exports.copyMessageAgent,
|
|
17
|
+
samples: [
|
|
18
|
+
{
|
|
19
|
+
inputs: [],
|
|
20
|
+
params: { count: 4, message: "hello" },
|
|
21
|
+
result: { messages: ["hello", "hello", "hello", "hello"] },
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
description: "CopyMessage agent",
|
|
25
|
+
category: [],
|
|
26
|
+
author: "Receptron team",
|
|
27
|
+
repository: "https://github.com/receptron/graphai",
|
|
28
|
+
license: "MIT",
|
|
29
|
+
};
|
|
30
|
+
exports.default = copyMessageAgentInfo;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
|
-
|
|
2
|
+
import { AgentFunctionInfo } from "../../type";
|
|
3
|
+
export declare const countingAgent: AgentFunction<{
|
|
4
|
+
count: number;
|
|
5
|
+
}, {
|
|
6
|
+
list: number[];
|
|
7
|
+
}>;
|
|
8
|
+
declare const countingAgentInfo: AgentFunctionInfo;
|
|
9
|
+
export default countingAgentInfo;
|
|
@@ -9,3 +9,22 @@ const countingAgent = async ({ params }) => {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
exports.countingAgent = countingAgent;
|
|
12
|
+
// for test and document
|
|
13
|
+
const countingAgentInfo = {
|
|
14
|
+
name: "countingAgent",
|
|
15
|
+
agent: exports.countingAgent,
|
|
16
|
+
mock: exports.countingAgent,
|
|
17
|
+
samples: [
|
|
18
|
+
{
|
|
19
|
+
inputs: [],
|
|
20
|
+
params: { count: 4 },
|
|
21
|
+
result: { list: [0, 1, 2, 3] },
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
description: "Counting agent",
|
|
25
|
+
category: [],
|
|
26
|
+
author: "Receptron team",
|
|
27
|
+
repository: "https://github.com/receptron/graphai",
|
|
28
|
+
license: "MIT",
|
|
29
|
+
};
|
|
30
|
+
exports.default = countingAgentInfo;
|
|
@@ -5,3 +5,16 @@ const echoAgent = async ({ params }) => {
|
|
|
5
5
|
return params;
|
|
6
6
|
};
|
|
7
7
|
exports.echoAgent = echoAgent;
|
|
8
|
+
// for test and document
|
|
9
|
+
const echoAgentInfo = {
|
|
10
|
+
name: "echoAgent",
|
|
11
|
+
agent: exports.echoAgent,
|
|
12
|
+
mock: exports.echoAgent,
|
|
13
|
+
samples: [],
|
|
14
|
+
description: "Echo agent",
|
|
15
|
+
category: [],
|
|
16
|
+
author: "Satoshi Nakajima",
|
|
17
|
+
repository: "https://github.com/receptron/graphai",
|
|
18
|
+
license: "MIT",
|
|
19
|
+
};
|
|
20
|
+
exports.default = echoAgentInfo;
|
|
@@ -8,3 +8,25 @@ const mergeNodeIdAgent = async ({ debugInfo: { nodeId }, inputs }) => {
|
|
|
8
8
|
}, { [nodeId]: "hello" });
|
|
9
9
|
};
|
|
10
10
|
exports.mergeNodeIdAgent = mergeNodeIdAgent;
|
|
11
|
+
// for test and document
|
|
12
|
+
const mergeNodeIdAgentInfo = {
|
|
13
|
+
name: "mergeNodeIdAgent",
|
|
14
|
+
agent: exports.mergeNodeIdAgent,
|
|
15
|
+
mock: exports.mergeNodeIdAgent,
|
|
16
|
+
samples: [
|
|
17
|
+
{
|
|
18
|
+
inputs: [{ message: "hello" }],
|
|
19
|
+
params: {},
|
|
20
|
+
result: {
|
|
21
|
+
message: "hello",
|
|
22
|
+
test: "hello",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
description: "merge node id agent",
|
|
27
|
+
category: [],
|
|
28
|
+
author: "Receptron team",
|
|
29
|
+
repository: "https://github.com/receptron/graphai",
|
|
30
|
+
license: "MIT",
|
|
31
|
+
};
|
|
32
|
+
exports.default = mergeNodeIdAgentInfo;
|