graphai 0.4.1 → 0.4.3
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 +7 -77
- package/lib/experimental_agents/array_agents/pop_agent.d.ts +1 -1
- package/lib/experimental_agents/array_agents/push_agent.d.ts +18 -4
- package/lib/experimental_agents/array_agents/push_agent.js +16 -2
- package/lib/experimental_agents/array_agents/shift_agent.d.ts +2 -2
- package/lib/experimental_agents/array_agents/shift_agent.js +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 +46 -1
- package/lib/experimental_agents/data_agents/property_filter_agent.js +28 -4
- package/lib/experimental_agents/data_agents/total_agent.d.ts +1 -1
- package/lib/experimental_agents/embedding_agent.d.ts +2 -2
- package/lib/experimental_agents/embedding_agent.js +1 -1
- package/lib/experimental_agents/graph_agents/map_agent.d.ts +2 -2
- package/lib/experimental_agents/graph_agents/map_agent.js +3 -3
- package/lib/experimental_agents/graph_agents/nested_agent.d.ts +2 -2
- package/lib/experimental_agents/graph_agents/nested_agent.js +3 -3
- package/lib/experimental_agents/graph_agents/packages.d.ts +2 -1
- package/lib/experimental_agents/graph_agents/packages.js +3 -1
- package/lib/experimental_agents/graph_agents/vanilla.d.ts +2 -1
- package/lib/experimental_agents/graph_agents/vanilla.js +3 -1
- package/lib/experimental_agents/graph_agents/worker_agent.d.ts +39 -0
- package/lib/experimental_agents/graph_agents/worker_agent.js +111 -0
- package/lib/experimental_agents/index.d.ts +2 -2
- package/lib/experimental_agents/index.js +2 -3
- 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 +33 -0
- package/lib/experimental_agents/input_agents/text_input_agent.js +30 -0
- package/lib/experimental_agents/llm_agents/anthropic_agent.d.ts +34 -0
- package/lib/experimental_agents/llm_agents/anthropic_agent.js +47 -0
- package/lib/experimental_agents/llm_agents/groq_agent.d.ts +15 -10
- package/lib/experimental_agents/llm_agents/groq_agent.js +34 -5
- package/lib/experimental_agents/llm_agents/index.d.ts +2 -2
- package/lib/experimental_agents/llm_agents/index.js +3 -3
- package/lib/experimental_agents/llm_agents/openai_agent.d.ts +13 -1
- package/lib/experimental_agents/llm_agents/openai_agent.js +15 -2
- package/lib/experimental_agents/llm_agents/packages.d.ts +2 -2
- package/lib/experimental_agents/llm_agents/packages.js +3 -3
- package/lib/experimental_agents/llm_agents/slashgpt_agent.d.ts +3 -1
- package/lib/experimental_agents/llm_agents/slashgpt_agent.js +2 -0
- package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +2 -2
- package/lib/experimental_agents/matrix_agents/dot_product_agent.js +1 -1
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.d.ts +2 -2
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.js +1 -1
- package/lib/experimental_agents/service_agents/fetch_agent.d.ts +1 -1
- package/lib/experimental_agents/service_agents/fetch_agent.js +1 -1
- package/lib/experimental_agents/service_agents/wikipedia.d.ts +1 -1
- package/lib/experimental_agents/service_agents/wikipedia.js +1 -1
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.d.ts +2 -2
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.js +1 -1
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.d.ts +2 -2
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.js +1 -1
- package/lib/experimental_agents/string_agents/json_parser_agent.d.ts +38 -0
- package/lib/experimental_agents/string_agents/json_parser_agent.js +39 -0
- package/lib/experimental_agents/string_agents/packages.d.ts +2 -1
- package/lib/experimental_agents/string_agents/packages.js +3 -1
- package/lib/experimental_agents/string_agents/string_splitter_agent.d.ts +2 -33
- package/lib/experimental_agents/string_agents/string_splitter_agent.js +1 -1
- package/lib/experimental_agents/string_agents/string_template_agent.d.ts +54 -10
- package/lib/experimental_agents/string_agents/string_template_agent.js +40 -10
- package/lib/experimental_agents/string_agents/vanilla.d.ts +2 -1
- package/lib/experimental_agents/string_agents/vanilla.js +3 -1
- package/lib/experimental_agents/test_agents/bypass_agent.d.ts +1 -1
- package/lib/experimental_agents/test_agents/bypass_agent.js +1 -1
- package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +1 -1
- package/lib/experimental_agents/test_agents/copy2array_agent.js +1 -1
- package/lib/experimental_agents/test_agents/copy_message_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/copy_message_agent.js +1 -1
- package/lib/experimental_agents/test_agents/counting_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/counting_agent.js +1 -1
- package/lib/experimental_agents/test_agents/echo_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/echo_agent.js +13 -2
- package/lib/experimental_agents/test_agents/merge_node_id_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/merge_node_id_agent.js +1 -1
- package/lib/experimental_agents/test_agents/stream_mock_agent.d.ts +1 -2
- package/lib/experimental_agents/test_agents/stream_mock_agent.js +9 -2
- package/lib/experimental_agents/token_agent.d.ts +1 -1
- package/lib/experimental_agents/vanilla.d.ts +1 -2
- package/lib/experimental_agents/vanilla.js +1 -3
- package/lib/graphai.d.ts +6 -6
- package/lib/graphai.js +9 -9
- package/lib/index.d.ts +3 -3
- package/lib/index.js +4 -2
- package/lib/node.d.ts +4 -2
- package/lib/node.js +44 -11
- package/lib/transaction_log.d.ts +1 -0
- package/lib/transaction_log.js +2 -0
- package/lib/type.d.ts +12 -6
- package/lib/utils/runner.d.ts +2 -0
- package/lib/utils/runner.js +20 -0
- package/lib/utils/test_agents.d.ts +2 -2
- package/lib/utils/test_utils.d.ts +1 -17
- package/lib/utils/test_utils.js +3 -21
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.js +45 -1
- package/lib/validators/agent_validator.js +2 -1
- package/lib/validators/common.d.ts +3 -0
- package/lib/validators/common.js +24 -2
- package/lib/validators/computed_node_validator.js +1 -1
- package/lib/validators/graph_data_validator.js +9 -9
- package/lib/validators/nodeValidator.js +3 -2
- package/lib/validators/relation_validator.js +6 -5
- package/lib/validators/static_node_validator.js +1 -1
- package/package.json +4 -1
- package/lib/experimental_agents/function_agent.d.ts +0 -42
- package/lib/experimental_agents/function_agent.js +0 -40
- package/lib/experimental_agents/llm_agents/groq_stream_agent.d.ts +0 -42
- package/lib/experimental_agents/llm_agents/groq_stream_agent.js +0 -84
|
@@ -30,7 +30,7 @@ const wikipediaAgentInfo = {
|
|
|
30
30
|
agent: exports.wikipediaAgent,
|
|
31
31
|
mock: exports.wikipediaAgent,
|
|
32
32
|
description: "Retrieves data from wikipedia",
|
|
33
|
-
category: ["
|
|
33
|
+
category: ["service"],
|
|
34
34
|
samples: [],
|
|
35
35
|
author: "Receptron",
|
|
36
36
|
repository: "https://github.com/receptron/graphai",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
export declare const sleeperAgent: AgentFunction<{
|
|
3
3
|
duration?: number;
|
|
4
4
|
value?: Record<string, any>;
|
|
@@ -15,7 +15,7 @@ declare const sleeperAgentInfo: {
|
|
|
15
15
|
}>;
|
|
16
16
|
samples: never[];
|
|
17
17
|
description: string;
|
|
18
|
-
category:
|
|
18
|
+
category: string[];
|
|
19
19
|
author: string;
|
|
20
20
|
repository: string;
|
|
21
21
|
license: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
2
|
export declare const sleeperAgentDebug: AgentFunction<{
|
|
3
3
|
duration: number;
|
|
4
4
|
value?: Record<string, any>;
|
|
@@ -18,7 +18,7 @@ declare const sleeperAgentDebugInfo: {
|
|
|
18
18
|
}>;
|
|
19
19
|
samples: never[];
|
|
20
20
|
description: string;
|
|
21
|
-
category:
|
|
21
|
+
category: string[];
|
|
22
22
|
author: string;
|
|
23
23
|
repository: string;
|
|
24
24
|
license: string;
|
|
@@ -23,7 +23,7 @@ const sleeperAgentDebugInfo = {
|
|
|
23
23
|
mock: exports.sleeperAgentDebug,
|
|
24
24
|
samples: [],
|
|
25
25
|
description: "sleeper debug Agent",
|
|
26
|
-
category: [],
|
|
26
|
+
category: ["sleeper"],
|
|
27
27
|
author: "Receptron team",
|
|
28
28
|
repository: "https://github.com/receptron/graphai",
|
|
29
29
|
license: "MIT",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
|
+
export declare const jsonParserAgent: AgentFunction<{
|
|
3
|
+
stringify: boolean;
|
|
4
|
+
}, any, any>;
|
|
5
|
+
declare const jsonParserAgentInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
agent: AgentFunction<{
|
|
8
|
+
stringify: boolean;
|
|
9
|
+
}, any, any>;
|
|
10
|
+
mock: AgentFunction<{
|
|
11
|
+
stringify: boolean;
|
|
12
|
+
}, any, any>;
|
|
13
|
+
samples: ({
|
|
14
|
+
inputs: {
|
|
15
|
+
apple: string;
|
|
16
|
+
lemon: string;
|
|
17
|
+
}[];
|
|
18
|
+
params: {
|
|
19
|
+
stringify: boolean;
|
|
20
|
+
};
|
|
21
|
+
result: string;
|
|
22
|
+
} | {
|
|
23
|
+
inputs: string[];
|
|
24
|
+
params: {
|
|
25
|
+
stringify?: undefined;
|
|
26
|
+
};
|
|
27
|
+
result: {
|
|
28
|
+
apple: string;
|
|
29
|
+
lemon: string;
|
|
30
|
+
};
|
|
31
|
+
})[];
|
|
32
|
+
description: string;
|
|
33
|
+
category: string[];
|
|
34
|
+
author: string;
|
|
35
|
+
repository: string;
|
|
36
|
+
license: string;
|
|
37
|
+
};
|
|
38
|
+
export default jsonParserAgentInfo;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonParserAgent = void 0;
|
|
4
|
+
const jsonParserAgent = async ({ params, inputs }) => {
|
|
5
|
+
if (params.stringify) {
|
|
6
|
+
return JSON.stringify(inputs[0], null, 2);
|
|
7
|
+
}
|
|
8
|
+
const match = ("\n" + inputs[0]).match(/\n```[a-zA-z]*([\s\S]*?)\n```/);
|
|
9
|
+
if (match) {
|
|
10
|
+
return JSON.parse(match[1]);
|
|
11
|
+
}
|
|
12
|
+
return JSON.parse(inputs[0]);
|
|
13
|
+
};
|
|
14
|
+
exports.jsonParserAgent = jsonParserAgent;
|
|
15
|
+
const sample_object = { apple: "red", lemon: "yellow" };
|
|
16
|
+
// for test and document
|
|
17
|
+
const jsonParserAgentInfo = {
|
|
18
|
+
name: "jsonParserAgent",
|
|
19
|
+
agent: exports.jsonParserAgent,
|
|
20
|
+
mock: exports.jsonParserAgent,
|
|
21
|
+
samples: [
|
|
22
|
+
{
|
|
23
|
+
inputs: [sample_object],
|
|
24
|
+
params: { stringify: true },
|
|
25
|
+
result: JSON.stringify(sample_object, null, 2),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
inputs: [JSON.stringify(sample_object, null, 2)],
|
|
29
|
+
params: {},
|
|
30
|
+
result: sample_object,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
description: "Template agent",
|
|
34
|
+
category: ["string"],
|
|
35
|
+
author: "Satoshi Nakajima",
|
|
36
|
+
repository: "https://github.com/receptron/graphai",
|
|
37
|
+
license: "MIT",
|
|
38
|
+
};
|
|
39
|
+
exports.default = jsonParserAgentInfo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import stringSplitterAgent from "../../experimental_agents/string_agents/string_splitter_agent";
|
|
2
2
|
import stringTemplateAgent from "../../experimental_agents/string_agents/string_template_agent";
|
|
3
|
-
|
|
3
|
+
import jsonParserAgent from "../../experimental_agents/string_agents/json_parser_agent";
|
|
4
|
+
export { stringSplitterAgent, stringTemplateAgent, jsonParserAgent };
|
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.stringTemplateAgent = exports.stringSplitterAgent = void 0;
|
|
6
|
+
exports.jsonParserAgent = exports.stringTemplateAgent = exports.stringSplitterAgent = void 0;
|
|
7
7
|
const string_splitter_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_splitter_agent"));
|
|
8
8
|
exports.stringSplitterAgent = string_splitter_agent_1.default;
|
|
9
9
|
const string_template_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_template_agent"));
|
|
10
10
|
exports.stringTemplateAgent = string_template_agent_1.default;
|
|
11
|
+
const json_parser_agent_1 = __importDefault(require("../../experimental_agents/string_agents/json_parser_agent"));
|
|
12
|
+
exports.jsonParserAgent = json_parser_agent_1.default;
|
|
@@ -1,40 +1,9 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction, AgentFunctionInfo } from "../../index";
|
|
2
2
|
export declare const stringSplitterAgent: AgentFunction<{
|
|
3
3
|
chunkSize?: number;
|
|
4
4
|
overlap?: number;
|
|
5
5
|
}, {
|
|
6
6
|
contents: Array<string>;
|
|
7
7
|
}, string>;
|
|
8
|
-
declare const stringSplitterAgentInfo:
|
|
9
|
-
name: string;
|
|
10
|
-
agent: AgentFunction<{
|
|
11
|
-
chunkSize?: number | undefined;
|
|
12
|
-
overlap?: number | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
contents: Array<string>;
|
|
15
|
-
}, string>;
|
|
16
|
-
mock: AgentFunction<{
|
|
17
|
-
chunkSize?: number | undefined;
|
|
18
|
-
overlap?: number | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
contents: Array<string>;
|
|
21
|
-
}, string>;
|
|
22
|
-
samples: {
|
|
23
|
-
inputs: string[];
|
|
24
|
-
params: {
|
|
25
|
-
chunkSize: number;
|
|
26
|
-
};
|
|
27
|
-
result: {
|
|
28
|
-
contents: string[];
|
|
29
|
-
count: number;
|
|
30
|
-
chunkSize: number;
|
|
31
|
-
overlap: number;
|
|
32
|
-
};
|
|
33
|
-
}[];
|
|
34
|
-
description: string;
|
|
35
|
-
category: never[];
|
|
36
|
-
author: string;
|
|
37
|
-
repository: string;
|
|
38
|
-
license: string;
|
|
39
|
-
};
|
|
8
|
+
declare const stringSplitterAgentInfo: AgentFunctionInfo;
|
|
40
9
|
export default stringSplitterAgentInfo;
|
|
@@ -57,7 +57,7 @@ const stringSplitterAgentInfo = {
|
|
|
57
57
|
},
|
|
58
58
|
],
|
|
59
59
|
description: "This agent strip one long string into chunks using following parameters",
|
|
60
|
-
category: [],
|
|
60
|
+
category: ["string"],
|
|
61
61
|
author: "Satoshi Nakajima",
|
|
62
62
|
repository: "https://github.com/receptron/graphai",
|
|
63
63
|
license: "MIT",
|
|
@@ -1,24 +1,68 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
1
|
+
import { AgentFunction } from "../../index";
|
|
2
|
+
type StringTemplate = string | Record<string, string>;
|
|
3
|
+
type StringTemplateObject = StringTemplate | StringTemplate[] | Record<string, StringTemplate>;
|
|
2
4
|
export declare const stringTemplateAgent: AgentFunction<{
|
|
3
|
-
template:
|
|
4
|
-
},
|
|
5
|
+
template: StringTemplateObject;
|
|
6
|
+
}, StringTemplateObject, string>;
|
|
5
7
|
declare const stringTemplateAgentInfo: {
|
|
6
8
|
name: string;
|
|
7
9
|
agent: AgentFunction<{
|
|
8
|
-
template:
|
|
9
|
-
},
|
|
10
|
+
template: StringTemplateObject;
|
|
11
|
+
}, StringTemplateObject, string>;
|
|
10
12
|
mock: AgentFunction<{
|
|
11
|
-
template:
|
|
12
|
-
},
|
|
13
|
-
samples: {
|
|
13
|
+
template: StringTemplateObject;
|
|
14
|
+
}, StringTemplateObject, string>;
|
|
15
|
+
samples: ({
|
|
14
16
|
inputs: string[];
|
|
15
17
|
params: {
|
|
16
18
|
template: string;
|
|
17
19
|
};
|
|
18
20
|
result: string;
|
|
19
|
-
}
|
|
21
|
+
} | {
|
|
22
|
+
inputs: string[];
|
|
23
|
+
params: {
|
|
24
|
+
template: string[];
|
|
25
|
+
};
|
|
26
|
+
result: string[];
|
|
27
|
+
} | {
|
|
28
|
+
inputs: string[];
|
|
29
|
+
params: {
|
|
30
|
+
template: {
|
|
31
|
+
apple: string;
|
|
32
|
+
lemon: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
result: {
|
|
36
|
+
apple: string;
|
|
37
|
+
lemon: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
inputs: string[];
|
|
41
|
+
params: {
|
|
42
|
+
template: {
|
|
43
|
+
apple: string;
|
|
44
|
+
lemon: string;
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
result: {
|
|
48
|
+
apple: string;
|
|
49
|
+
lemon: string;
|
|
50
|
+
}[];
|
|
51
|
+
} | {
|
|
52
|
+
inputs: string[];
|
|
53
|
+
params: {
|
|
54
|
+
template: {
|
|
55
|
+
apple: string;
|
|
56
|
+
lemon: string[];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
result: {
|
|
60
|
+
apple: string;
|
|
61
|
+
lemon: string[];
|
|
62
|
+
};
|
|
63
|
+
})[];
|
|
20
64
|
description: string;
|
|
21
|
-
category:
|
|
65
|
+
category: string[];
|
|
22
66
|
author: string;
|
|
23
67
|
repository: string;
|
|
24
68
|
license: string;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringTemplateAgent = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const processTemplate = (template, match, input) => {
|
|
5
|
+
if (typeof template === "string") {
|
|
6
|
+
return template.replace(match, input);
|
|
7
|
+
}
|
|
8
|
+
else if (Array.isArray(template)) {
|
|
9
|
+
return template.map((item) => processTemplate(item, match, input));
|
|
10
|
+
}
|
|
11
|
+
return Object.keys(template).reduce((tmp, key) => {
|
|
12
|
+
tmp[key] = processTemplate(template[key], match, input);
|
|
13
|
+
return tmp;
|
|
14
|
+
}, {});
|
|
15
|
+
};
|
|
6
16
|
const stringTemplateAgent = async ({ params, inputs }) => {
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
if (params.template === undefined) {
|
|
18
|
+
console.warn("warning: stringTemplateAgent no template");
|
|
19
|
+
}
|
|
20
|
+
return inputs.reduce((template, input, index) => {
|
|
21
|
+
return processTemplate(template, "${" + index + "}", input);
|
|
9
22
|
}, params.template);
|
|
10
|
-
return content;
|
|
11
23
|
};
|
|
12
24
|
exports.stringTemplateAgent = stringTemplateAgent;
|
|
13
25
|
const sampleInput = ["hello", "test"];
|
|
14
|
-
const sampleParams = { template: "${0}: ${1}" };
|
|
15
|
-
const sampleResult = "hello: test";
|
|
16
26
|
// for test and document
|
|
17
27
|
const stringTemplateAgentInfo = {
|
|
18
28
|
name: "stringTemplateAgent",
|
|
@@ -21,12 +31,32 @@ const stringTemplateAgentInfo = {
|
|
|
21
31
|
samples: [
|
|
22
32
|
{
|
|
23
33
|
inputs: sampleInput,
|
|
24
|
-
params:
|
|
25
|
-
result:
|
|
34
|
+
params: { template: "${0}: ${1}" },
|
|
35
|
+
result: "hello: test",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
inputs: sampleInput,
|
|
39
|
+
params: { template: ["${0}: ${1}", "${1}: ${0}"] },
|
|
40
|
+
result: ["hello: test", "test: hello"],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
inputs: sampleInput,
|
|
44
|
+
params: { template: { apple: "${0}", lemon: "${1}" } },
|
|
45
|
+
result: { apple: "hello", lemon: "test" },
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
inputs: sampleInput,
|
|
49
|
+
params: { template: [{ apple: "${0}", lemon: "${1}" }] },
|
|
50
|
+
result: [{ apple: "hello", lemon: "test" }],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
inputs: sampleInput,
|
|
54
|
+
params: { template: { apple: "${0}", lemon: ["${1}"] } },
|
|
55
|
+
result: { apple: "hello", lemon: ["test"] },
|
|
26
56
|
},
|
|
27
57
|
],
|
|
28
58
|
description: "Template agent",
|
|
29
|
-
category: [],
|
|
59
|
+
category: ["string"],
|
|
30
60
|
author: "Satoshi Nakajima",
|
|
31
61
|
repository: "https://github.com/receptron/graphai",
|
|
32
62
|
license: "MIT",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import stringSplitterAgent from "../../experimental_agents/string_agents/string_splitter_agent";
|
|
2
2
|
import stringTemplateAgent from "../../experimental_agents/string_agents/string_template_agent";
|
|
3
|
-
|
|
3
|
+
import jsonParserAgent from "../../experimental_agents/string_agents/json_parser_agent";
|
|
4
|
+
export { stringSplitterAgent, stringTemplateAgent, jsonParserAgent };
|
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.stringTemplateAgent = exports.stringSplitterAgent = void 0;
|
|
6
|
+
exports.jsonParserAgent = exports.stringTemplateAgent = exports.stringSplitterAgent = void 0;
|
|
7
7
|
const string_splitter_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_splitter_agent"));
|
|
8
8
|
exports.stringSplitterAgent = string_splitter_agent_1.default;
|
|
9
9
|
const string_template_agent_1 = __importDefault(require("../../experimental_agents/string_agents/string_template_agent"));
|
|
10
10
|
exports.stringTemplateAgent = string_template_agent_1.default;
|
|
11
|
+
const json_parser_agent_1 = __importDefault(require("../../experimental_agents/string_agents/json_parser_agent"));
|
|
12
|
+
exports.jsonParserAgent = json_parser_agent_1.default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
2
|
-
import { AgentFunctionInfo } from "../../type";
|
|
1
|
+
import { AgentFunction, AgentFunctionInfo } from "../../index";
|
|
3
2
|
export declare const echoAgent: AgentFunction;
|
|
4
3
|
declare const echoAgentInfo: AgentFunctionInfo;
|
|
5
4
|
export default echoAgentInfo;
|
|
@@ -13,9 +13,20 @@ const echoAgentInfo = {
|
|
|
13
13
|
name: "echoAgent",
|
|
14
14
|
agent: exports.echoAgent,
|
|
15
15
|
mock: exports.echoAgent,
|
|
16
|
-
samples: [
|
|
16
|
+
samples: [
|
|
17
|
+
{
|
|
18
|
+
inputs: [],
|
|
19
|
+
params: { message: "this is test" },
|
|
20
|
+
result: { message: "this is test" },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
inputs: [],
|
|
24
|
+
params: { message: "If you add filterParams option, it will respond to filterParams", filterParams: true },
|
|
25
|
+
result: {},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
17
28
|
description: "Echo agent",
|
|
18
|
-
category: [],
|
|
29
|
+
category: ["test"],
|
|
19
30
|
author: "Satoshi Nakajima",
|
|
20
31
|
repository: "https://github.com/receptron/graphai",
|
|
21
32
|
license: "MIT",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
2
|
-
import { AgentFunctionInfo } from "../../type";
|
|
1
|
+
import { AgentFunction, AgentFunctionInfo } from "../../index";
|
|
3
2
|
export declare const mergeNodeIdAgent: AgentFunction;
|
|
4
3
|
declare const mergeNodeIdAgentInfo: AgentFunctionInfo;
|
|
5
4
|
export default mergeNodeIdAgentInfo;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AgentFunction } from "../../
|
|
2
|
-
import { AgentFunctionInfo } from "../../type";
|
|
1
|
+
import { AgentFunction, AgentFunctionInfo } from "../../index";
|
|
3
2
|
export declare const streamMockAgent: AgentFunction;
|
|
4
3
|
declare const streamMockAgentInfo: AgentFunctionInfo;
|
|
5
4
|
export default streamMockAgentInfo;
|
|
@@ -18,11 +18,18 @@ const streamMockAgentInfo = {
|
|
|
18
18
|
name: "streamMockAgent",
|
|
19
19
|
agent: exports.streamMockAgent,
|
|
20
20
|
mock: exports.streamMockAgent,
|
|
21
|
-
samples: [
|
|
21
|
+
samples: [
|
|
22
|
+
{
|
|
23
|
+
inputs: [],
|
|
24
|
+
params: { message: "this is test" },
|
|
25
|
+
result: { message: "this is test" },
|
|
26
|
+
},
|
|
27
|
+
],
|
|
22
28
|
description: "Stream mock agent",
|
|
23
|
-
category: [],
|
|
29
|
+
category: ["test"],
|
|
24
30
|
author: "Isamu Arimoto",
|
|
25
31
|
repository: "https://github.com/receptron/graphai",
|
|
26
32
|
license: "MIT",
|
|
33
|
+
stream: true,
|
|
27
34
|
};
|
|
28
35
|
exports.default = streamMockAgentInfo;
|
|
@@ -4,6 +4,5 @@ export * from "./matrix_agents/vanilla";
|
|
|
4
4
|
export * from "./test_agents/vanilla";
|
|
5
5
|
export * from "./graph_agents/vanilla";
|
|
6
6
|
export * from "./data_agents/vanilla";
|
|
7
|
-
import functionAgent from "./function_agent";
|
|
8
7
|
import stringEmbeddingsAgent from "./embedding_agent";
|
|
9
|
-
export {
|
|
8
|
+
export { stringEmbeddingsAgent };
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.stringEmbeddingsAgent =
|
|
21
|
+
exports.stringEmbeddingsAgent = void 0;
|
|
22
22
|
// Please refrain from adding agents that require npm. Those should be added to the index.ts.
|
|
23
23
|
__exportStar(require("./string_agents/vanilla"), exports);
|
|
24
24
|
__exportStar(require("./array_agents/vanilla"), exports);
|
|
@@ -26,7 +26,5 @@ __exportStar(require("./matrix_agents/vanilla"), exports);
|
|
|
26
26
|
__exportStar(require("./test_agents/vanilla"), exports);
|
|
27
27
|
__exportStar(require("./graph_agents/vanilla"), exports);
|
|
28
28
|
__exportStar(require("./data_agents/vanilla"), exports);
|
|
29
|
-
const function_agent_1 = __importDefault(require("./function_agent"));
|
|
30
|
-
exports.functionAgent = function_agent_1.default;
|
|
31
29
|
const embedding_agent_1 = __importDefault(require("./embedding_agent"));
|
|
32
30
|
exports.stringEmbeddingsAgent = embedding_agent_1.default;
|
package/lib/graphai.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { AgentFunctionInfoDictonary, AgentFilterInfo, GraphData, DataSource, ResultDataDictonary, ResultData, DefaultResultData } from "./type";
|
|
1
|
+
import { AgentFunctionInfoDictionary, AgentFilterInfo, GraphData, DataSource, ResultDataDictionary, ResultData, DefaultResultData } from "./type";
|
|
3
2
|
import { TransactionLog } from "./transaction_log";
|
|
4
3
|
import { ComputedNode, StaticNode } from "./node";
|
|
5
4
|
import { TaskManager } from "./task_manager";
|
|
@@ -10,7 +9,7 @@ export declare class GraphAI {
|
|
|
10
9
|
private readonly data;
|
|
11
10
|
private readonly loop?;
|
|
12
11
|
private readonly logs;
|
|
13
|
-
readonly agentFunctionInfoDictionary:
|
|
12
|
+
readonly agentFunctionInfoDictionary: AgentFunctionInfoDictionary;
|
|
14
13
|
readonly taskManager: TaskManager;
|
|
15
14
|
readonly agentFilters: AgentFilterInfo[];
|
|
16
15
|
readonly retryLimit?: number;
|
|
@@ -22,19 +21,19 @@ export declare class GraphAI {
|
|
|
22
21
|
private createNodes;
|
|
23
22
|
private getValueFromResults;
|
|
24
23
|
private initializeNodes;
|
|
25
|
-
constructor(data: GraphData, agentFunctionInfoDictionary:
|
|
24
|
+
constructor(data: GraphData, agentFunctionInfoDictionary: AgentFunctionInfoDictionary, options?: {
|
|
26
25
|
agentFilters?: AgentFilterInfo[] | undefined;
|
|
27
26
|
taskManager?: TaskManager | undefined;
|
|
28
27
|
});
|
|
29
28
|
getAgentFunctionInfo(agentId?: string): import("./type").AgentFunctionInfo;
|
|
30
29
|
asString(): string;
|
|
31
|
-
results<T = DefaultResultData>(all: boolean):
|
|
30
|
+
results<T = DefaultResultData>(all: boolean): ResultDataDictionary<T>;
|
|
32
31
|
errors(): Record<string, Error>;
|
|
33
32
|
private pushReadyNodesIntoQueue;
|
|
34
33
|
private pushQueueIfReady;
|
|
35
34
|
pushQueueIfReadyAndRunning(node: ComputedNode): void;
|
|
36
35
|
pushQueue(node: ComputedNode): void;
|
|
37
|
-
run<T = DefaultResultData>(all?: boolean): Promise<
|
|
36
|
+
run<T = DefaultResultData>(all?: boolean): Promise<ResultDataDictionary<T>>;
|
|
38
37
|
isRunning(): boolean;
|
|
39
38
|
onExecutionComplete(node: ComputedNode): void;
|
|
40
39
|
private processLoopIfNecessary;
|
|
@@ -45,3 +44,4 @@ export declare class GraphAI {
|
|
|
45
44
|
injectValue(nodeId: string, value: ResultData, injectFrom?: string): void;
|
|
46
45
|
resultsOf(sources: Array<DataSource>): ResultData[];
|
|
47
46
|
}
|
|
47
|
+
export {};
|