graphai 0.1.1 → 0.2.0
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 +145 -106
- 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 +26 -0
- package/lib/experimental_agents/array_agents/pop_agent.js +40 -0
- package/lib/experimental_agents/array_agents/push_agent.d.ts +16 -0
- package/lib/experimental_agents/array_agents/push_agent.js +18 -0
- package/lib/experimental_agents/array_agents/shift_agent.d.ts +26 -0
- package/lib/experimental_agents/array_agents/shift_agent.js +29 -0
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.d.ts +81 -0
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.js +37 -0
- 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 +2 -1
- package/lib/experimental_agents/data_agents/packages.d.ts +4 -0
- package/lib/experimental_agents/data_agents/packages.js +12 -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/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 +4 -5
- package/lib/experimental_agents/index.js +4 -5
- package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +18 -0
- package/lib/experimental_agents/{matrix_agent.js → matrix_agents/dot_product_agent.js} +26 -27
- package/lib/experimental_agents/matrix_agents/index.d.ts +2 -0
- package/lib/experimental_agents/matrix_agents/index.js +7 -0
- 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 +20 -0
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.js +41 -0
- package/lib/experimental_agents/packages.d.ts +11 -0
- package/lib/experimental_agents/packages.js +33 -0
- package/lib/experimental_agents/slashgpt_agent.d.ts +24 -0
- package/lib/experimental_agents/slashgpt_agent.js +12 -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 +33 -0
- package/lib/experimental_agents/string_agents/string_splitter_agent.js +41 -0
- package/lib/experimental_agents/string_agents/string_template_agent.d.ts +24 -0
- package/lib/experimental_agents/string_agents/string_template_agent.js +22 -0
- package/lib/experimental_agents/test_agents/bypass_agent.d.ts +3 -0
- package/lib/experimental_agents/test_agents/bypass_agent.js +24 -0
- package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +7 -0
- package/lib/experimental_agents/test_agents/copy2array_agent.js +39 -0
- 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/index.d.ts +1 -0
- package/lib/experimental_agents/test_agents/index.js +3 -1
- 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 +1 -1
- package/lib/graphai.js +9 -16
- package/lib/node.d.ts +2 -2
- package/lib/node.js +19 -21
- package/lib/transaction_log.js +1 -1
- package/lib/type.d.ts +4 -3
- package/lib/utils/test_agents.d.ts +2 -0
- package/lib/utils/test_agents.js +20 -0
- package/lib/utils/test_utils.d.ts +12 -0
- package/lib/utils/test_utils.js +34 -0
- package/lib/utils/utils.d.ts +3 -1
- package/lib/utils/utils.js +30 -2
- package/package.json +10 -11
- package/lib/experimental_agents/map_agent.d.ts +0 -4
- package/lib/experimental_agents/matrix_agent.d.ts +0 -9
- package/lib/experimental_agents/nested_agent.d.ts +0 -6
- package/lib/experimental_agents/nested_agent.js +0 -30
- package/lib/experimental_agents/test_agents/echo_fork_index_agent.d.ts +0 -2
- package/lib/experimental_agents/test_agents/echo_fork_index_agent.js +0 -7
- package/lib/log.d.ts +0 -22
- package/lib/log.js +0 -49
- package/lib/task.d.ts +0 -18
- package/lib/task.js +0 -63
|
@@ -23,8 +23,9 @@ const dataSumTemplateAgentInfo = {
|
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
25
|
description: "Returns the sum of input values",
|
|
26
|
+
category: [],
|
|
26
27
|
author: "Satoshi Nakajima",
|
|
27
|
-
repository: "https://github.com/
|
|
28
|
+
repository: "https://github.com/receptron/graphai",
|
|
28
29
|
license: "MIT",
|
|
29
30
|
};
|
|
30
31
|
exports.default = dataSumTemplateAgentInfo;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import totalAgent from "../../experimental_agents/data_agents/total_agent";
|
|
2
|
+
import dataObjectMergeTemplateAgent from "../../experimental_agents/data_agents/data_object_merge_template_agent";
|
|
3
|
+
import dataSumTemplateAgent from "../../experimental_agents/data_agents/data_sum_template_agent";
|
|
4
|
+
export { totalAgent, dataObjectMergeTemplateAgent, dataSumTemplateAgent };
|
|
@@ -0,0 +1,12 @@
|
|
|
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.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = exports.totalAgent = void 0;
|
|
7
|
+
const total_agent_1 = __importDefault(require("../../experimental_agents/data_agents/total_agent"));
|
|
8
|
+
exports.totalAgent = total_agent_1.default;
|
|
9
|
+
const data_object_merge_template_agent_1 = __importDefault(require("../../experimental_agents/data_agents/data_object_merge_template_agent"));
|
|
10
|
+
exports.dataObjectMergeTemplateAgent = data_object_merge_template_agent_1.default;
|
|
11
|
+
const data_sum_template_agent_1 = __importDefault(require("../../experimental_agents/data_agents/data_sum_template_agent"));
|
|
12
|
+
exports.dataSumTemplateAgent = data_sum_template_agent_1.default;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { AgentFunction } from "../graphai";
|
|
2
2
|
export declare const stringEmbeddingsAgent: AgentFunction<{
|
|
3
3
|
model?: string;
|
|
4
|
-
},
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
}, any, Array<string> | string>;
|
|
5
|
+
declare const stringEmbeddingsAgentInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
agent: AgentFunction<{
|
|
8
|
+
model?: string | undefined;
|
|
9
|
+
}, any, string | string[]>;
|
|
10
|
+
mock: AgentFunction<{
|
|
11
|
+
model?: string | undefined;
|
|
12
|
+
}, any, string | string[]>;
|
|
13
|
+
samples: never[];
|
|
14
|
+
description: string;
|
|
15
|
+
category: never[];
|
|
16
|
+
author: string;
|
|
17
|
+
repository: string;
|
|
18
|
+
license: string;
|
|
19
|
+
};
|
|
20
|
+
export default stringEmbeddingsAgentInfo;
|
|
@@ -38,6 +38,18 @@ const stringEmbeddingsAgent = async ({ params, inputs }) => {
|
|
|
38
38
|
const embeddings = jsonResponse.data.map((object) => {
|
|
39
39
|
return object.embedding;
|
|
40
40
|
});
|
|
41
|
-
return
|
|
41
|
+
return embeddings;
|
|
42
42
|
};
|
|
43
43
|
exports.stringEmbeddingsAgent = stringEmbeddingsAgent;
|
|
44
|
+
const stringEmbeddingsAgentInfo = {
|
|
45
|
+
name: "stringEmbeddingsAgent",
|
|
46
|
+
agent: exports.stringEmbeddingsAgent,
|
|
47
|
+
mock: exports.stringEmbeddingsAgent,
|
|
48
|
+
samples: [],
|
|
49
|
+
description: "Embeddings Agent",
|
|
50
|
+
category: [],
|
|
51
|
+
author: "Receptron team",
|
|
52
|
+
repository: "https://github.com/receptron/graphai",
|
|
53
|
+
license: "MIT",
|
|
54
|
+
};
|
|
55
|
+
exports.default = stringEmbeddingsAgentInfo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapAgent = exports.nestedAgent = void 0;
|
|
4
|
+
var nested_agent_1 = require("../../experimental_agents/graph_agents/nested_agent");
|
|
5
|
+
Object.defineProperty(exports, "nestedAgent", { enumerable: true, get: function () { return nested_agent_1.nestedAgent; } });
|
|
6
|
+
var map_agent_1 = require("../../experimental_agents/graph_agents/map_agent");
|
|
7
|
+
Object.defineProperty(exports, "mapAgent", { enumerable: true, get: function () { return map_agent_1.mapAgent; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
export declare const mapAgent: AgentFunction<{
|
|
3
|
+
injectionTo?: Array<string>;
|
|
4
|
+
}, Record<string, Array<any>>, any>;
|
|
5
|
+
declare const mapAgentInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
agent: AgentFunction<{
|
|
8
|
+
injectionTo?: string[] | undefined;
|
|
9
|
+
}, Record<string, any[]>, any>;
|
|
10
|
+
mock: AgentFunction<{
|
|
11
|
+
injectionTo?: string[] | undefined;
|
|
12
|
+
}, Record<string, any[]>, any>;
|
|
13
|
+
samples: never[];
|
|
14
|
+
description: string;
|
|
15
|
+
category: never[];
|
|
16
|
+
author: string;
|
|
17
|
+
repository: string;
|
|
18
|
+
license: string;
|
|
19
|
+
};
|
|
20
|
+
export default mapAgentInfo;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapAgent = void 0;
|
|
4
|
-
const graphai_1 = require("
|
|
5
|
-
const utils_1 = require("
|
|
4
|
+
const graphai_1 = require("../../graphai");
|
|
5
|
+
const utils_1 = require("../../utils/utils");
|
|
6
|
+
const nested_agent_1 = require("./nested_agent");
|
|
6
7
|
const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData }) => {
|
|
7
8
|
if (taskManager) {
|
|
8
9
|
const status = taskManager.getStatus();
|
|
9
10
|
(0, utils_1.assert)(status.concurrency > status.running, `mapAgent: Concurrency is too low: ${status.concurrency}`);
|
|
10
11
|
}
|
|
11
|
-
(0,
|
|
12
|
+
const nestedGraphData = (0, nested_agent_1.getNestedGraphData)(graphData, inputs);
|
|
12
13
|
const input = Array.isArray(inputs[0]) ? inputs[0] : inputs;
|
|
13
|
-
const injectionTo = params.injectionTo ??
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const injectionTo = params.injectionTo ??
|
|
15
|
+
inputs.map((__input, index) => {
|
|
16
|
+
return `$${index}`;
|
|
17
|
+
});
|
|
18
|
+
injectionTo.forEach((nodeId) => {
|
|
19
|
+
if (nestedGraphData.nodes[nodeId] === undefined) {
|
|
20
|
+
// If the input node does not exist, automatically create a static node
|
|
21
|
+
nestedGraphData.nodes[nodeId] = { value: {} };
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
const graphs = input.map((data) => {
|
|
19
|
-
const graphAI = new graphai_1.GraphAI(
|
|
20
|
-
|
|
25
|
+
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, taskManager);
|
|
26
|
+
// Only the first input will be mapped
|
|
27
|
+
injectionTo.forEach((injectToNodeId, index) => {
|
|
28
|
+
graphAI.injectValue(injectToNodeId, index === 0 ? data : inputs[index], "__mapAgent_inputs__");
|
|
29
|
+
});
|
|
21
30
|
return graphAI;
|
|
22
31
|
});
|
|
23
32
|
const runs = graphs.map((graph) => {
|
|
@@ -44,3 +53,15 @@ const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData })
|
|
|
44
53
|
return compositeResult;
|
|
45
54
|
};
|
|
46
55
|
exports.mapAgent = mapAgent;
|
|
56
|
+
const mapAgentInfo = {
|
|
57
|
+
name: "mapAgent",
|
|
58
|
+
agent: exports.mapAgent,
|
|
59
|
+
mock: exports.mapAgent,
|
|
60
|
+
samples: [],
|
|
61
|
+
description: "Map Agent",
|
|
62
|
+
category: [],
|
|
63
|
+
author: "Receptron team",
|
|
64
|
+
repository: "https://github.com/receptron/graphai",
|
|
65
|
+
license: "MIT",
|
|
66
|
+
};
|
|
67
|
+
exports.default = mapAgentInfo;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
import { GraphData } from "../../type";
|
|
3
|
+
export declare const getNestedGraphData: (graphData: GraphData | string | undefined, inputs: Array<any>) => GraphData;
|
|
4
|
+
export declare const nestedAgent: AgentFunction<{
|
|
5
|
+
injectionTo?: Array<string>;
|
|
6
|
+
}>;
|
|
7
|
+
declare const nestedAgentInfo: {
|
|
8
|
+
name: string;
|
|
9
|
+
agent: AgentFunction<{
|
|
10
|
+
injectionTo?: string[] | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
mock: AgentFunction<{
|
|
13
|
+
injectionTo?: string[] | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
samples: never[];
|
|
16
|
+
description: string;
|
|
17
|
+
category: never[];
|
|
18
|
+
author: string;
|
|
19
|
+
repository: string;
|
|
20
|
+
license: string;
|
|
21
|
+
};
|
|
22
|
+
export default nestedAgentInfo;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nestedAgent = exports.getNestedGraphData = void 0;
|
|
4
|
+
const graphai_1 = require("../../graphai");
|
|
5
|
+
const utils_1 = require("../../utils/utils");
|
|
6
|
+
// This function allows us to use one of inputs as the graph data for this nested agent,
|
|
7
|
+
// which is equivalent to "eval" of JavaScript.
|
|
8
|
+
const getNestedGraphData = (graphData, inputs) => {
|
|
9
|
+
(0, utils_1.assert)(graphData !== undefined, "nestedAgent: graphData is required");
|
|
10
|
+
if (typeof graphData === "string") {
|
|
11
|
+
const regex = /^\$(\d+)$/;
|
|
12
|
+
const match = graphData.match(regex);
|
|
13
|
+
if (match) {
|
|
14
|
+
const index = parseInt(match[1], 10);
|
|
15
|
+
if (index < inputs.length) {
|
|
16
|
+
return inputs[index];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
(0, utils_1.assert)(false, `getNestedGraphData: Invalid graphData string: ${graphData}`);
|
|
20
|
+
}
|
|
21
|
+
return graphData;
|
|
22
|
+
};
|
|
23
|
+
exports.getNestedGraphData = getNestedGraphData;
|
|
24
|
+
const nestedAgent = async ({ params, inputs, agents, log, taskManager, graphData }) => {
|
|
25
|
+
if (taskManager) {
|
|
26
|
+
const status = taskManager.getStatus(false);
|
|
27
|
+
(0, utils_1.assert)(status.concurrency > status.running, `nestedAgent: Concurrency is too low: ${status.concurrency}`);
|
|
28
|
+
}
|
|
29
|
+
const nestedGraphData = (0, exports.getNestedGraphData)(graphData, inputs);
|
|
30
|
+
const injectionTo = params.injectionTo ??
|
|
31
|
+
inputs.map((__input, index) => {
|
|
32
|
+
return `$${index}`;
|
|
33
|
+
});
|
|
34
|
+
injectionTo.forEach((nodeId) => {
|
|
35
|
+
if (nestedGraphData.nodes[nodeId] === undefined) {
|
|
36
|
+
// If the input node does not exist, automatically create a static node
|
|
37
|
+
nestedGraphData.nodes[nodeId] = { value: {} };
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, taskManager);
|
|
41
|
+
try {
|
|
42
|
+
// Inject inputs to specified source nodes
|
|
43
|
+
injectionTo.forEach((injectToNodeId, index) => {
|
|
44
|
+
graphAI.injectValue(injectToNodeId, inputs[index]);
|
|
45
|
+
});
|
|
46
|
+
const results = await graphAI.run(false);
|
|
47
|
+
log?.push(...graphAI.transactionLogs());
|
|
48
|
+
return results;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
log?.push(...graphAI.transactionLogs());
|
|
52
|
+
if (error instanceof Error) {
|
|
53
|
+
console.log("Error:", error.message);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.nestedAgent = nestedAgent;
|
|
59
|
+
const nestedAgentInfo = {
|
|
60
|
+
name: "nestedAgent",
|
|
61
|
+
agent: exports.nestedAgent,
|
|
62
|
+
mock: exports.nestedAgent,
|
|
63
|
+
samples: [],
|
|
64
|
+
description: "nested Agent",
|
|
65
|
+
category: [],
|
|
66
|
+
author: "Receptron team",
|
|
67
|
+
repository: "https://github.com/receptron/graphai",
|
|
68
|
+
license: "MIT",
|
|
69
|
+
};
|
|
70
|
+
exports.default = nestedAgentInfo;
|
|
@@ -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.mapAgent = exports.nestedAgent = void 0;
|
|
7
|
+
const nested_agent_1 = __importDefault(require("../../experimental_agents/graph_agents/nested_agent"));
|
|
8
|
+
exports.nestedAgent = nested_agent_1.default;
|
|
9
|
+
const map_agent_1 = __importDefault(require("../../experimental_agents/graph_agents/map_agent"));
|
|
10
|
+
exports.mapAgent = map_agent_1.default;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export * from "./string_agents";
|
|
2
|
-
export * from "./slashgpt_agent";
|
|
3
2
|
export * from "./sleeper_agents";
|
|
4
3
|
export * from "./data_agents";
|
|
5
|
-
export * from "./nested_agent";
|
|
6
4
|
export * from "./array_agents";
|
|
5
|
+
export * from "./matrix_agents";
|
|
6
|
+
export * from "./test_agents";
|
|
7
|
+
export * from "./graph_agents";
|
|
8
|
+
export * from "./slashgpt_agent";
|
|
7
9
|
export * from "./embedding_agent";
|
|
8
|
-
export * from "./matrix_agent";
|
|
9
10
|
export * from "./token_agent";
|
|
10
|
-
export * from "./test_agents";
|
|
11
|
-
export * from "./map_agent";
|
|
@@ -15,13 +15,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./string_agents"), exports);
|
|
18
|
-
__exportStar(require("./slashgpt_agent"), exports);
|
|
19
18
|
__exportStar(require("./sleeper_agents"), exports);
|
|
20
19
|
__exportStar(require("./data_agents"), exports);
|
|
21
|
-
__exportStar(require("./nested_agent"), exports);
|
|
22
20
|
__exportStar(require("./array_agents"), exports);
|
|
21
|
+
__exportStar(require("./matrix_agents"), exports);
|
|
22
|
+
__exportStar(require("./test_agents"), exports);
|
|
23
|
+
__exportStar(require("./graph_agents"), exports);
|
|
24
|
+
__exportStar(require("./slashgpt_agent"), exports);
|
|
23
25
|
__exportStar(require("./embedding_agent"), exports);
|
|
24
|
-
__exportStar(require("./matrix_agent"), exports);
|
|
25
26
|
__exportStar(require("./token_agent"), exports);
|
|
26
|
-
__exportStar(require("./test_agents"), exports);
|
|
27
|
-
__exportStar(require("./map_agent"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.dotProductAgent = void 0;
|
|
4
4
|
// This agent calculates the dot product of an array of vectors (A[]) and a vector (B),
|
|
5
5
|
// typically used to calculate cosine similarity of embedding vectors.
|
|
6
6
|
// Inputs:
|
|
@@ -19,32 +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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return { contents };
|
|
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",
|
|
49
48
|
};
|
|
50
|
-
exports.
|
|
49
|
+
exports.default = dotProductAgentInfo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortByValuesAgent = exports.dotProductAgent = void 0;
|
|
4
|
+
var dot_product_agent_1 = require("../../experimental_agents/matrix_agents/dot_product_agent");
|
|
5
|
+
Object.defineProperty(exports, "dotProductAgent", { enumerable: true, get: function () { return dot_product_agent_1.dotProductAgent; } });
|
|
6
|
+
var sort_by_values_agent_1 = require("../../experimental_agents/matrix_agents/sort_by_values_agent");
|
|
7
|
+
Object.defineProperty(exports, "sortByValuesAgent", { enumerable: true, get: function () { return sort_by_values_agent_1.sortByValuesAgent; } });
|
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
export declare const sortByValuesAgent: AgentFunction<{
|
|
3
|
+
assendant?: boolean;
|
|
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;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortByValuesAgent = void 0;
|
|
4
|
+
// This agent returned a sorted array of one array (A) based on another array (B).
|
|
5
|
+
// The default sorting order is "decendant".
|
|
6
|
+
//
|
|
7
|
+
// Parameters:
|
|
8
|
+
// acendant: Specifies if the sorting order should be acendant. The default is "false" (decendant).
|
|
9
|
+
// Inputs:
|
|
10
|
+
// inputs[0]: Array<any>; // array to be sorted
|
|
11
|
+
// inputs[1]: Array<number>; // array of numbers for sorting
|
|
12
|
+
//
|
|
13
|
+
const sortByValuesAgent = async ({ params, inputs }) => {
|
|
14
|
+
const direction = params?.assendant ?? false ? -1 : 1;
|
|
15
|
+
const sources = inputs[0];
|
|
16
|
+
const values = inputs[1];
|
|
17
|
+
const joined = sources.map((item, index) => {
|
|
18
|
+
return { item, value: values[index] };
|
|
19
|
+
});
|
|
20
|
+
const contents = joined
|
|
21
|
+
.sort((a, b) => {
|
|
22
|
+
return (b.value - a.value) * direction;
|
|
23
|
+
})
|
|
24
|
+
.map((a) => {
|
|
25
|
+
return a.item;
|
|
26
|
+
});
|
|
27
|
+
return contents;
|
|
28
|
+
};
|
|
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,11 @@
|
|
|
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
|
+
import slashGPTAgent from "./slashgpt_agent";
|
|
9
|
+
import stringEmbeddingsAgent from "./embedding_agent";
|
|
10
|
+
import tokenBoundStringsAgent from "./token_agent";
|
|
11
|
+
export { slashGPTAgent, stringEmbeddingsAgent, tokenBoundStringsAgent };
|
|
@@ -0,0 +1,33 @@
|
|
|
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.tokenBoundStringsAgent = exports.stringEmbeddingsAgent = exports.slashGPTAgent = 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
|
+
const slashgpt_agent_1 = __importDefault(require("./slashgpt_agent"));
|
|
29
|
+
exports.slashGPTAgent = slashgpt_agent_1.default;
|
|
30
|
+
const embedding_agent_1 = __importDefault(require("./embedding_agent"));
|
|
31
|
+
exports.stringEmbeddingsAgent = embedding_agent_1.default;
|
|
32
|
+
const token_agent_1 = __importDefault(require("./token_agent"));
|
|
33
|
+
exports.tokenBoundStringsAgent = token_agent_1.default;
|
|
@@ -7,3 +7,27 @@ export declare const slashGPTAgent: AgentFunction<{
|
|
|
7
7
|
}, {
|
|
8
8
|
content: string;
|
|
9
9
|
}, string>;
|
|
10
|
+
declare const slashGPTAgentInfo: {
|
|
11
|
+
name: string;
|
|
12
|
+
agent: AgentFunction<{
|
|
13
|
+
manifest: ManifestData;
|
|
14
|
+
query?: string | undefined;
|
|
15
|
+
function_result?: boolean | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
content: string;
|
|
18
|
+
}, string>;
|
|
19
|
+
mock: AgentFunction<{
|
|
20
|
+
manifest: ManifestData;
|
|
21
|
+
query?: string | undefined;
|
|
22
|
+
function_result?: boolean | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
content: string;
|
|
25
|
+
}, string>;
|
|
26
|
+
samples: never[];
|
|
27
|
+
description: string;
|
|
28
|
+
category: never[];
|
|
29
|
+
author: string;
|
|
30
|
+
repository: string;
|
|
31
|
+
license: string;
|
|
32
|
+
};
|
|
33
|
+
export default slashGPTAgentInfo;
|
|
@@ -28,3 +28,15 @@ const slashGPTAgent = async ({ params, inputs, debugInfo: { verbose, nodeId } })
|
|
|
28
28
|
return message;
|
|
29
29
|
};
|
|
30
30
|
exports.slashGPTAgent = slashGPTAgent;
|
|
31
|
+
const slashGPTAgentInfo = {
|
|
32
|
+
name: "slashGPTAgent",
|
|
33
|
+
agent: exports.slashGPTAgent,
|
|
34
|
+
mock: exports.slashGPTAgent,
|
|
35
|
+
samples: [],
|
|
36
|
+
description: "Slash GPT Agent",
|
|
37
|
+
category: [],
|
|
38
|
+
author: "Receptron team",
|
|
39
|
+
repository: "https://github.com/receptron/graphai",
|
|
40
|
+
license: "MIT",
|
|
41
|
+
};
|
|
42
|
+
exports.default = slashGPTAgentInfo;
|
|
@@ -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;
|