graphai 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/graphai.d.ts +6 -6
- package/lib/graphai.js +14 -2
- package/lib/index.d.ts +1 -1
- package/lib/type.d.ts +5 -0
- package/lib/utils/test_utils.d.ts +0 -2
- package/lib/utils/test_utils.js +1 -28
- package/lib/utils/utils.js +4 -2
- package/package.json +4 -5
- package/README.md +0 -383
- package/lib/experimental_agents/array_agents/index.d.ts +0 -1
- package/lib/experimental_agents/array_agents/index.js +0 -17
- package/lib/experimental_agents/array_agents/packages.d.ts +0 -4
- package/lib/experimental_agents/array_agents/packages.js +0 -12
- package/lib/experimental_agents/array_agents/pop_agent.d.ts +0 -28
- package/lib/experimental_agents/array_agents/pop_agent.js +0 -50
- package/lib/experimental_agents/array_agents/push_agent.d.ts +0 -32
- package/lib/experimental_agents/array_agents/push_agent.js +0 -41
- package/lib/experimental_agents/array_agents/shift_agent.d.ts +0 -28
- package/lib/experimental_agents/array_agents/shift_agent.js +0 -39
- package/lib/experimental_agents/array_agents/vanilla.d.ts +0 -4
- package/lib/experimental_agents/array_agents/vanilla.js +0 -12
- package/lib/experimental_agents/data_agents/copy_agent.d.ts +0 -28
- package/lib/experimental_agents/data_agents/copy_agent.js +0 -31
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.d.ts +0 -126
- package/lib/experimental_agents/data_agents/data_object_merge_template_agent.js +0 -72
- package/lib/experimental_agents/data_agents/data_sum_template_agent.d.ts +0 -18
- package/lib/experimental_agents/data_agents/data_sum_template_agent.js +0 -46
- package/lib/experimental_agents/data_agents/index.d.ts +0 -3
- package/lib/experimental_agents/data_agents/index.js +0 -23
- package/lib/experimental_agents/data_agents/packages.d.ts +0 -6
- package/lib/experimental_agents/data_agents/packages.js +0 -16
- package/lib/experimental_agents/data_agents/property_filter_agent.d.ts +0 -237
- package/lib/experimental_agents/data_agents/property_filter_agent.js +0 -140
- package/lib/experimental_agents/data_agents/total_agent.d.ts +0 -60
- package/lib/experimental_agents/data_agents/total_agent.js +0 -81
- package/lib/experimental_agents/data_agents/vanilla.d.ts +0 -5
- package/lib/experimental_agents/data_agents/vanilla.js +0 -14
- package/lib/experimental_agents/embedding_agent.d.ts +0 -20
- package/lib/experimental_agents/embedding_agent.js +0 -55
- package/lib/experimental_agents/graph_agents/index.d.ts +0 -1
- package/lib/experimental_agents/graph_agents/index.js +0 -17
- package/lib/experimental_agents/graph_agents/map_agent.d.ts +0 -23
- package/lib/experimental_agents/graph_agents/map_agent.js +0 -70
- package/lib/experimental_agents/graph_agents/nested_agent.d.ts +0 -22
- package/lib/experimental_agents/graph_agents/nested_agent.js +0 -58
- package/lib/experimental_agents/graph_agents/packages.d.ts +0 -4
- package/lib/experimental_agents/graph_agents/packages.js +0 -12
- package/lib/experimental_agents/graph_agents/vanilla.d.ts +0 -4
- package/lib/experimental_agents/graph_agents/vanilla.js +0 -12
- package/lib/experimental_agents/graph_agents/worker_agent.d.ts +0 -39
- package/lib/experimental_agents/graph_agents/worker_agent.js +0 -111
- package/lib/experimental_agents/index.d.ts +0 -13
- package/lib/experimental_agents/index.js +0 -36
- package/lib/experimental_agents/input_agents/index.d.ts +0 -2
- package/lib/experimental_agents/input_agents/index.js +0 -8
- package/lib/experimental_agents/input_agents/packages.d.ts +0 -2
- package/lib/experimental_agents/input_agents/packages.js +0 -8
- package/lib/experimental_agents/input_agents/text_input_agent.d.ts +0 -33
- package/lib/experimental_agents/input_agents/text_input_agent.js +0 -30
- package/lib/experimental_agents/llm_agents/anthropic_agent.d.ts +0 -34
- package/lib/experimental_agents/llm_agents/anthropic_agent.js +0 -47
- package/lib/experimental_agents/llm_agents/groq_agent.d.ts +0 -47
- package/lib/experimental_agents/llm_agents/groq_agent.js +0 -97
- package/lib/experimental_agents/llm_agents/index.d.ts +0 -5
- package/lib/experimental_agents/llm_agents/index.js +0 -14
- package/lib/experimental_agents/llm_agents/openai_agent.d.ts +0 -70
- package/lib/experimental_agents/llm_agents/openai_agent.js +0 -100
- package/lib/experimental_agents/llm_agents/packages.d.ts +0 -5
- package/lib/experimental_agents/llm_agents/packages.js +0 -14
- package/lib/experimental_agents/llm_agents/slashgpt_agent.d.ts +0 -29
- package/lib/experimental_agents/llm_agents/slashgpt_agent.js +0 -39
- package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +0 -18
- package/lib/experimental_agents/matrix_agents/dot_product_agent.js +0 -60
- package/lib/experimental_agents/matrix_agents/index.d.ts +0 -1
- package/lib/experimental_agents/matrix_agents/index.js +0 -17
- package/lib/experimental_agents/matrix_agents/packages.d.ts +0 -3
- package/lib/experimental_agents/matrix_agents/packages.js +0 -10
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.d.ts +0 -32
- package/lib/experimental_agents/matrix_agents/sort_by_values_agent.js +0 -60
- package/lib/experimental_agents/matrix_agents/vanilla.d.ts +0 -3
- package/lib/experimental_agents/matrix_agents/vanilla.js +0 -10
- package/lib/experimental_agents/service_agents/fetch_agent.d.ts +0 -62
- package/lib/experimental_agents/service_agents/fetch_agent.js +0 -95
- package/lib/experimental_agents/service_agents/index.d.ts +0 -3
- package/lib/experimental_agents/service_agents/index.js +0 -10
- package/lib/experimental_agents/service_agents/packages.d.ts +0 -3
- package/lib/experimental_agents/service_agents/packages.js +0 -10
- package/lib/experimental_agents/service_agents/wikipedia.d.ts +0 -23
- package/lib/experimental_agents/service_agents/wikipedia.js +0 -39
- package/lib/experimental_agents/sleeper_agents/index.d.ts +0 -3
- package/lib/experimental_agents/sleeper_agents/index.js +0 -10
- package/lib/experimental_agents/sleeper_agents/packages.d.ts +0 -3
- package/lib/experimental_agents/sleeper_agents/packages.js +0 -10
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.d.ts +0 -23
- package/lib/experimental_agents/sleeper_agents/sleeper_agent.js +0 -28
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.d.ts +0 -26
- package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.js +0 -31
- package/lib/experimental_agents/string_agents/index.d.ts +0 -1
- package/lib/experimental_agents/string_agents/index.js +0 -17
- package/lib/experimental_agents/string_agents/json_parser_agent.d.ts +0 -38
- package/lib/experimental_agents/string_agents/json_parser_agent.js +0 -39
- package/lib/experimental_agents/string_agents/packages.d.ts +0 -4
- package/lib/experimental_agents/string_agents/packages.js +0 -12
- package/lib/experimental_agents/string_agents/string_splitter_agent.d.ts +0 -9
- package/lib/experimental_agents/string_agents/string_splitter_agent.js +0 -65
- package/lib/experimental_agents/string_agents/string_template_agent.d.ts +0 -70
- package/lib/experimental_agents/string_agents/string_template_agent.js +0 -64
- package/lib/experimental_agents/string_agents/vanilla.d.ts +0 -4
- package/lib/experimental_agents/string_agents/vanilla.js +0 -12
- package/lib/experimental_agents/test_agents/bypass_agent.d.ts +0 -8
- package/lib/experimental_agents/test_agents/bypass_agent.js +0 -59
- package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +0 -7
- package/lib/experimental_agents/test_agents/copy2array_agent.js +0 -39
- package/lib/experimental_agents/test_agents/copy_message_agent.d.ts +0 -9
- package/lib/experimental_agents/test_agents/copy_message_agent.js +0 -30
- package/lib/experimental_agents/test_agents/counting_agent.d.ts +0 -8
- package/lib/experimental_agents/test_agents/counting_agent.js +0 -30
- package/lib/experimental_agents/test_agents/echo_agent.d.ts +0 -4
- package/lib/experimental_agents/test_agents/echo_agent.js +0 -34
- package/lib/experimental_agents/test_agents/index.d.ts +0 -1
- package/lib/experimental_agents/test_agents/index.js +0 -17
- package/lib/experimental_agents/test_agents/merge_node_id_agent.d.ts +0 -4
- package/lib/experimental_agents/test_agents/merge_node_id_agent.js +0 -32
- package/lib/experimental_agents/test_agents/packages.d.ts +0 -8
- package/lib/experimental_agents/test_agents/packages.js +0 -20
- package/lib/experimental_agents/test_agents/stream_mock_agent.d.ts +0 -4
- package/lib/experimental_agents/test_agents/stream_mock_agent.js +0 -35
- package/lib/experimental_agents/test_agents/vanilla.d.ts +0 -8
- package/lib/experimental_agents/test_agents/vanilla.js +0 -20
- package/lib/experimental_agents/token_agent.d.ts +0 -36
- package/lib/experimental_agents/token_agent.js +0 -74
- package/lib/experimental_agents/vanilla.d.ts +0 -8
- package/lib/experimental_agents/vanilla.js +0 -30
- package/lib/utils/test_agents.d.ts +0 -2
- package/lib/utils/test_agents.js +0 -24
- package/lib/vanilla_agents.d.ts +0 -1
- package/lib/vanilla_agents.js +0 -17
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groqAgent = void 0;
|
|
4
|
-
const groq_sdk_1 = require("groq-sdk");
|
|
5
|
-
const utils_1 = require("../../utils/utils");
|
|
6
|
-
const groq = process.env.GROQ_API_KEY ? new groq_sdk_1.Groq({ apiKey: process.env.GROQ_API_KEY }) : undefined;
|
|
7
|
-
//
|
|
8
|
-
// This agent takes two optional inputs, and following parameters.
|
|
9
|
-
// inputs:
|
|
10
|
-
// - [0]: query string (typically from the user), optional
|
|
11
|
-
// - [1]: array of messages from previous conversation, optional
|
|
12
|
-
//
|
|
13
|
-
// params:
|
|
14
|
-
// - model: LLM model (Llama3-8b-8192, Llama3-70b-8192, Mixtral-8x7b-32768), required.
|
|
15
|
-
// - query: Additional query string from the app to prepend the query from the user, optional.
|
|
16
|
-
// - system: System prompt (ignored if inputs[1] is specified), optional
|
|
17
|
-
// - tools: Function definitions, optional
|
|
18
|
-
// - tool_choice: Tool choice parameter, optional (default = "auto")
|
|
19
|
-
// - temperature: Controls randomness of responses, optional (default = 0.7)
|
|
20
|
-
// - max_tokens: The maximum number of tokens that the model can process in a single response, optional.
|
|
21
|
-
// - verbose: dumps the message array to the debug console, before sending it the LLM.
|
|
22
|
-
//
|
|
23
|
-
// https://console.groq.com/docs/quickstart
|
|
24
|
-
//
|
|
25
|
-
const groqAgent = async ({ params, inputs, filterParams }) => {
|
|
26
|
-
(0, utils_1.assert)(groq !== undefined, "The GROQ_API_KEY environment variable is missing.");
|
|
27
|
-
const { verbose, query, system, tools, tool_choice, max_tokens, temperature, stream } = params;
|
|
28
|
-
const [input_query, previous_messages] = inputs;
|
|
29
|
-
// Notice that we ignore params.system if previous_message exists.
|
|
30
|
-
const messages = previous_messages && Array.isArray(previous_messages) ? previous_messages : system ? [{ role: "system", content: system }] : [];
|
|
31
|
-
const content = (query ? [query] : []).concat(input_query && typeof input_query === "string" ? [input_query] : []).join("\n");
|
|
32
|
-
if (content) {
|
|
33
|
-
messages.push({
|
|
34
|
-
role: "user",
|
|
35
|
-
content,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
if (verbose) {
|
|
39
|
-
console.log(messages);
|
|
40
|
-
}
|
|
41
|
-
const streamOption = {
|
|
42
|
-
messages,
|
|
43
|
-
model: params.model,
|
|
44
|
-
temperature: temperature ?? 0.7,
|
|
45
|
-
stream: true,
|
|
46
|
-
};
|
|
47
|
-
const nonStreamOption = {
|
|
48
|
-
messages,
|
|
49
|
-
model: params.model,
|
|
50
|
-
temperature: temperature ?? 0.7,
|
|
51
|
-
};
|
|
52
|
-
const options = stream ? streamOption : nonStreamOption;
|
|
53
|
-
if (max_tokens) {
|
|
54
|
-
options.max_tokens = max_tokens;
|
|
55
|
-
}
|
|
56
|
-
if (tools) {
|
|
57
|
-
options.tools = tools;
|
|
58
|
-
options.tool_choice = tool_choice ?? "auto";
|
|
59
|
-
}
|
|
60
|
-
if (!options.stream) {
|
|
61
|
-
const result = await groq.chat.completions.create(options);
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
// streaming
|
|
65
|
-
const pipe = await groq.chat.completions.create(options);
|
|
66
|
-
let lastMessage = null;
|
|
67
|
-
const contents = [];
|
|
68
|
-
for await (const message of pipe) {
|
|
69
|
-
const token = message.choices[0].delta.content;
|
|
70
|
-
if (token) {
|
|
71
|
-
if (filterParams && filterParams.streamTokenCallback) {
|
|
72
|
-
filterParams.streamTokenCallback(token);
|
|
73
|
-
}
|
|
74
|
-
contents.push(token);
|
|
75
|
-
}
|
|
76
|
-
lastMessage = message;
|
|
77
|
-
}
|
|
78
|
-
if (lastMessage) {
|
|
79
|
-
lastMessage.choices[0]["message"] = [{ role: "assistant", content: contents.join("") }];
|
|
80
|
-
}
|
|
81
|
-
return lastMessage;
|
|
82
|
-
};
|
|
83
|
-
exports.groqAgent = groqAgent;
|
|
84
|
-
const groqAgentInfo = {
|
|
85
|
-
name: "groqAgent",
|
|
86
|
-
agent: exports.groqAgent,
|
|
87
|
-
mock: exports.groqAgent,
|
|
88
|
-
samples: [],
|
|
89
|
-
description: "Groq Agent",
|
|
90
|
-
category: ["llm"],
|
|
91
|
-
author: "Receptron team",
|
|
92
|
-
repository: "https://github.com/receptron/graphai",
|
|
93
|
-
license: "MIT",
|
|
94
|
-
stream: true,
|
|
95
|
-
npms: ["groq-sdk"],
|
|
96
|
-
};
|
|
97
|
-
exports.default = groqAgentInfo;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import groqAgent from "../../experimental_agents/llm_agents/groq_agent";
|
|
2
|
-
import slashGPTAgent from "../../experimental_agents/llm_agents/slashgpt_agent";
|
|
3
|
-
import openAIAgent from "../../experimental_agents/llm_agents/openai_agent";
|
|
4
|
-
import anthropicAgent from "../../experimental_agents/llm_agents/anthropic_agent";
|
|
5
|
-
export { groqAgent, slashGPTAgent, openAIAgent, anthropicAgent };
|
|
@@ -1,14 +0,0 @@
|
|
|
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.anthropicAgent = exports.openAIAgent = exports.slashGPTAgent = exports.groqAgent = void 0;
|
|
7
|
-
const groq_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/groq_agent"));
|
|
8
|
-
exports.groqAgent = groq_agent_1.default;
|
|
9
|
-
const slashgpt_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/slashgpt_agent"));
|
|
10
|
-
exports.slashGPTAgent = slashgpt_agent_1.default;
|
|
11
|
-
const openai_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/openai_agent"));
|
|
12
|
-
exports.openAIAgent = openai_agent_1.default;
|
|
13
|
-
const anthropic_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/anthropic_agent"));
|
|
14
|
-
exports.anthropicAgent = anthropic_agent_1.default;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { AgentFunction } from "../../index";
|
|
2
|
-
export declare const openAIAgent: AgentFunction<{
|
|
3
|
-
model?: string;
|
|
4
|
-
query?: string;
|
|
5
|
-
system?: string;
|
|
6
|
-
tools?: any;
|
|
7
|
-
tool_choice?: any;
|
|
8
|
-
verbose?: boolean;
|
|
9
|
-
temperature?: number;
|
|
10
|
-
baseURL?: string;
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
stream?: boolean;
|
|
13
|
-
}, Record<string, any> | string, string | Array<any>>;
|
|
14
|
-
export declare const openAIMockAgent: AgentFunction<{
|
|
15
|
-
model?: string;
|
|
16
|
-
query?: string;
|
|
17
|
-
system?: string;
|
|
18
|
-
verbose?: boolean;
|
|
19
|
-
temperature?: number;
|
|
20
|
-
}, Record<string, any> | string, string | Array<any>>;
|
|
21
|
-
declare const openaiAgentInfo: {
|
|
22
|
-
name: string;
|
|
23
|
-
agent: AgentFunction<{
|
|
24
|
-
model?: string | undefined;
|
|
25
|
-
query?: string | undefined;
|
|
26
|
-
system?: string | undefined;
|
|
27
|
-
tools?: any;
|
|
28
|
-
tool_choice?: any;
|
|
29
|
-
verbose?: boolean | undefined;
|
|
30
|
-
temperature?: number | undefined;
|
|
31
|
-
baseURL?: string | undefined;
|
|
32
|
-
apiKey?: string | undefined;
|
|
33
|
-
stream?: boolean | undefined;
|
|
34
|
-
}, string | Record<string, any>, string | any[]>;
|
|
35
|
-
mock: AgentFunction<{
|
|
36
|
-
model?: string | undefined;
|
|
37
|
-
query?: string | undefined;
|
|
38
|
-
system?: string | undefined;
|
|
39
|
-
verbose?: boolean | undefined;
|
|
40
|
-
temperature?: number | undefined;
|
|
41
|
-
}, string | Record<string, any>, string | any[]>;
|
|
42
|
-
samples: {
|
|
43
|
-
inputs: string[];
|
|
44
|
-
params: {};
|
|
45
|
-
result: {
|
|
46
|
-
object: string;
|
|
47
|
-
id: string;
|
|
48
|
-
choices: {
|
|
49
|
-
message: {
|
|
50
|
-
role: string;
|
|
51
|
-
content: string;
|
|
52
|
-
};
|
|
53
|
-
finish_reason: string;
|
|
54
|
-
index: number;
|
|
55
|
-
logprobs: null;
|
|
56
|
-
}[];
|
|
57
|
-
created: number;
|
|
58
|
-
model: string;
|
|
59
|
-
};
|
|
60
|
-
}[];
|
|
61
|
-
skipTest: boolean;
|
|
62
|
-
description: string;
|
|
63
|
-
category: string[];
|
|
64
|
-
author: string;
|
|
65
|
-
repository: string;
|
|
66
|
-
license: string;
|
|
67
|
-
stream: boolean;
|
|
68
|
-
npms: string[];
|
|
69
|
-
};
|
|
70
|
-
export default openaiAgentInfo;
|
|
@@ -1,100 +0,0 @@
|
|
|
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.openAIMockAgent = exports.openAIAgent = void 0;
|
|
7
|
-
const openai_1 = __importDefault(require("openai"));
|
|
8
|
-
const utils_1 = require("../../utils/utils");
|
|
9
|
-
const openAIAgent = async ({ filterParams, params, inputs }) => {
|
|
10
|
-
const { verbose, query, system, temperature, baseURL, apiKey, stream } = params;
|
|
11
|
-
const [input_query, previous_messages] = inputs;
|
|
12
|
-
// Notice that we ignore params.system if previous_message exists.
|
|
13
|
-
const messages = previous_messages && Array.isArray(previous_messages) ? previous_messages : system ? [{ role: "system", content: system }] : [];
|
|
14
|
-
const content = (query ? [query] : []).concat(input_query ? [input_query] : []).join("\n");
|
|
15
|
-
if (content) {
|
|
16
|
-
messages.push({
|
|
17
|
-
role: "user",
|
|
18
|
-
content,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (verbose) {
|
|
22
|
-
console.log(messages);
|
|
23
|
-
}
|
|
24
|
-
const openai = apiKey && baseURL ? new openai_1.default({ apiKey, baseURL }) : new openai_1.default();
|
|
25
|
-
if (!stream) {
|
|
26
|
-
return await openai.chat.completions.create({
|
|
27
|
-
model: params.model || "gpt-3.5-turbo",
|
|
28
|
-
messages,
|
|
29
|
-
tools: params.tools,
|
|
30
|
-
tool_choice: params.tool_choice,
|
|
31
|
-
temperature: temperature ?? 0.7,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const chatStream = await openai.beta.chat.completions.stream({
|
|
35
|
-
model: params.model || "gpt-3.5-turbo",
|
|
36
|
-
messages,
|
|
37
|
-
tools: params.tools,
|
|
38
|
-
tool_choice: params.tool_choice,
|
|
39
|
-
temperature: temperature ?? 0.7,
|
|
40
|
-
stream: true,
|
|
41
|
-
});
|
|
42
|
-
for await (const message of chatStream) {
|
|
43
|
-
const token = message.choices[0].delta.content;
|
|
44
|
-
if (filterParams && filterParams.streamTokenCallback && token) {
|
|
45
|
-
filterParams.streamTokenCallback(token);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const chatCompletion = await chatStream.finalChatCompletion();
|
|
49
|
-
return chatCompletion;
|
|
50
|
-
};
|
|
51
|
-
exports.openAIAgent = openAIAgent;
|
|
52
|
-
const input_sample = "this is response result";
|
|
53
|
-
const result_sample = {
|
|
54
|
-
object: "chat.completion",
|
|
55
|
-
id: "chatcmpl-9N7HxXYbwjmdbdiQE94MHoVluQhyt",
|
|
56
|
-
choices: [
|
|
57
|
-
{
|
|
58
|
-
message: {
|
|
59
|
-
role: "assistant",
|
|
60
|
-
content: input_sample,
|
|
61
|
-
},
|
|
62
|
-
finish_reason: "stop",
|
|
63
|
-
index: 0,
|
|
64
|
-
logprobs: null,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
created: 1715296589,
|
|
68
|
-
model: "gpt-3.5-turbo-0125",
|
|
69
|
-
};
|
|
70
|
-
const openAIMockAgent = async ({ filterParams }) => {
|
|
71
|
-
for await (const token of input_sample.split("")) {
|
|
72
|
-
if (filterParams && filterParams.streamTokenCallback && token) {
|
|
73
|
-
await (0, utils_1.sleep)(100);
|
|
74
|
-
filterParams.streamTokenCallback(token);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return result_sample;
|
|
78
|
-
};
|
|
79
|
-
exports.openAIMockAgent = openAIMockAgent;
|
|
80
|
-
const openaiAgentInfo = {
|
|
81
|
-
name: "openAIAgent",
|
|
82
|
-
agent: exports.openAIAgent,
|
|
83
|
-
mock: exports.openAIMockAgent,
|
|
84
|
-
samples: [
|
|
85
|
-
{
|
|
86
|
-
inputs: [input_sample],
|
|
87
|
-
params: {},
|
|
88
|
-
result: result_sample,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
skipTest: true,
|
|
92
|
-
description: "Openai Agent",
|
|
93
|
-
category: ["llm"],
|
|
94
|
-
author: "Receptron team",
|
|
95
|
-
repository: "https://github.com/receptron/graphai",
|
|
96
|
-
license: "MIT",
|
|
97
|
-
stream: true,
|
|
98
|
-
npms: ["openai"],
|
|
99
|
-
};
|
|
100
|
-
exports.default = openaiAgentInfo;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import groqAgent from "../../experimental_agents/llm_agents/groq_agent";
|
|
2
|
-
import slashGPTAgent from "../../experimental_agents/llm_agents/slashgpt_agent";
|
|
3
|
-
import openAIAgent from "../../experimental_agents/llm_agents/openai_agent";
|
|
4
|
-
import anthropicAgent from "../../experimental_agents/llm_agents/openai_agent";
|
|
5
|
-
export { groqAgent, slashGPTAgent, openAIAgent, anthropicAgent };
|
|
@@ -1,14 +0,0 @@
|
|
|
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.anthropicAgent = exports.openAIAgent = exports.slashGPTAgent = exports.groqAgent = void 0;
|
|
7
|
-
const groq_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/groq_agent"));
|
|
8
|
-
exports.groqAgent = groq_agent_1.default;
|
|
9
|
-
const slashgpt_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/slashgpt_agent"));
|
|
10
|
-
exports.slashGPTAgent = slashgpt_agent_1.default;
|
|
11
|
-
const openai_agent_1 = __importDefault(require("../../experimental_agents/llm_agents/openai_agent"));
|
|
12
|
-
exports.openAIAgent = openai_agent_1.default;
|
|
13
|
-
const openai_agent_2 = __importDefault(require("../../experimental_agents/llm_agents/openai_agent"));
|
|
14
|
-
exports.anthropicAgent = openai_agent_2.default;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AgentFunction } from "../../index";
|
|
2
|
-
import { ManifestData, ChatData } from "slashgpt";
|
|
3
|
-
export declare const slashGPTAgent: AgentFunction<{
|
|
4
|
-
manifest: ManifestData;
|
|
5
|
-
query?: string;
|
|
6
|
-
function_result?: boolean;
|
|
7
|
-
}, ChatData[], string>;
|
|
8
|
-
declare const slashGPTAgentInfo: {
|
|
9
|
-
name: string;
|
|
10
|
-
agent: AgentFunction<{
|
|
11
|
-
manifest: ManifestData;
|
|
12
|
-
query?: string | undefined;
|
|
13
|
-
function_result?: boolean | undefined;
|
|
14
|
-
}, ChatData[], string>;
|
|
15
|
-
mock: AgentFunction<{
|
|
16
|
-
manifest: ManifestData;
|
|
17
|
-
query?: string | undefined;
|
|
18
|
-
function_result?: boolean | undefined;
|
|
19
|
-
}, ChatData[], string>;
|
|
20
|
-
samples: never[];
|
|
21
|
-
description: string;
|
|
22
|
-
category: string[];
|
|
23
|
-
author: string;
|
|
24
|
-
repository: string;
|
|
25
|
-
license: string;
|
|
26
|
-
stream: boolean;
|
|
27
|
-
npms: string[];
|
|
28
|
-
};
|
|
29
|
-
export default slashGPTAgentInfo;
|
|
@@ -1,39 +0,0 @@
|
|
|
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.slashGPTAgent = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const slashgpt_1 = require("slashgpt");
|
|
9
|
-
const config = new slashgpt_1.ChatConfig(path_1.default.resolve(__dirname));
|
|
10
|
-
const slashGPTAgent = async ({ params, inputs, debugInfo: { verbose, nodeId }, filterParams }) => {
|
|
11
|
-
if (verbose) {
|
|
12
|
-
console.log("executing", nodeId, params);
|
|
13
|
-
}
|
|
14
|
-
const session = new slashgpt_1.ChatSession(config, params.manifest ?? {});
|
|
15
|
-
const query = params?.query ? [params.query] : [];
|
|
16
|
-
const contents = query.concat(inputs);
|
|
17
|
-
session.append_user_question(contents.join("\n"));
|
|
18
|
-
await session.call_loop(() => { }, (token) => {
|
|
19
|
-
if (filterParams && filterParams.streamTokenCallback && token) {
|
|
20
|
-
filterParams.streamTokenCallback(token);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return session.history.messages();
|
|
24
|
-
};
|
|
25
|
-
exports.slashGPTAgent = slashGPTAgent;
|
|
26
|
-
const slashGPTAgentInfo = {
|
|
27
|
-
name: "slashGPTAgent",
|
|
28
|
-
agent: exports.slashGPTAgent,
|
|
29
|
-
mock: exports.slashGPTAgent,
|
|
30
|
-
samples: [],
|
|
31
|
-
description: "Slash GPT Agent",
|
|
32
|
-
category: ["llm"],
|
|
33
|
-
author: "Receptron team",
|
|
34
|
-
repository: "https://github.com/receptron/graphai",
|
|
35
|
-
license: "MIT",
|
|
36
|
-
stream: true,
|
|
37
|
-
npms: ["slashgpt"],
|
|
38
|
-
};
|
|
39
|
-
exports.default = slashGPTAgentInfo;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AgentFunction } from "../../index";
|
|
2
|
-
export declare const dotProductAgent: AgentFunction<Record<never, never>, Array<number>, Array<Array<number>> | Array<number>>;
|
|
3
|
-
declare const dotProductAgentInfo: {
|
|
4
|
-
name: string;
|
|
5
|
-
agent: AgentFunction<Record<never, never>, number[], number[] | number[][]>;
|
|
6
|
-
mock: AgentFunction<Record<never, never>, number[], number[] | number[][]>;
|
|
7
|
-
samples: {
|
|
8
|
-
inputs: (number[] | number[][])[];
|
|
9
|
-
params: {};
|
|
10
|
-
result: number[];
|
|
11
|
-
}[];
|
|
12
|
-
description: string;
|
|
13
|
-
category: string[];
|
|
14
|
-
author: string;
|
|
15
|
-
repository: string;
|
|
16
|
-
license: string;
|
|
17
|
-
};
|
|
18
|
-
export default dotProductAgentInfo;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dotProductAgent = void 0;
|
|
4
|
-
// This agent calculates the dot product of an array of vectors (A[]) and a vector (B),
|
|
5
|
-
// typically used to calculate cosine similarity of embedding vectors.
|
|
6
|
-
// Inputs:
|
|
7
|
-
// inputs[0]: Two dimentional array of numbers.
|
|
8
|
-
// inputs[1]: One dimentional array of numbers.
|
|
9
|
-
// Outputs:
|
|
10
|
-
// { contents: Array<number> } // array of docProduct of each vector (A[]) and vector B
|
|
11
|
-
const dotProductAgent = async ({ inputs }) => {
|
|
12
|
-
const embeddings = inputs[0];
|
|
13
|
-
const reference = inputs[1];
|
|
14
|
-
if (embeddings[0].length != reference.length) {
|
|
15
|
-
throw new Error(`dotProduct: Length of vectors do not match. ${embeddings[0].length}, ${reference.length}`);
|
|
16
|
-
}
|
|
17
|
-
const contents = embeddings.map((embedding) => {
|
|
18
|
-
return embedding.reduce((dotProduct, value, index) => {
|
|
19
|
-
return dotProduct + value * reference[index];
|
|
20
|
-
}, 0);
|
|
21
|
-
});
|
|
22
|
-
return contents;
|
|
23
|
-
};
|
|
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
|
-
inputs: [
|
|
44
|
-
[
|
|
45
|
-
[1, 2],
|
|
46
|
-
[2, 3],
|
|
47
|
-
],
|
|
48
|
-
[1, 2],
|
|
49
|
-
],
|
|
50
|
-
params: {},
|
|
51
|
-
result: [5, 8],
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
description: "dotProduct Agent",
|
|
55
|
-
category: ["matrix"],
|
|
56
|
-
author: "Receptron team",
|
|
57
|
-
repository: "https://github.com/receptron/graphai",
|
|
58
|
-
license: "MIT",
|
|
59
|
-
};
|
|
60
|
-
exports.default = dotProductAgentInfo;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./vanilla";
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./vanilla"), exports);
|
|
@@ -1,10 +0,0 @@
|
|
|
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,32 +0,0 @@
|
|
|
1
|
-
import { AgentFunction } from "../../index";
|
|
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: ({
|
|
14
|
-
inputs: (string[] | number[])[];
|
|
15
|
-
params: {
|
|
16
|
-
assendant?: undefined;
|
|
17
|
-
};
|
|
18
|
-
result: string[];
|
|
19
|
-
} | {
|
|
20
|
-
inputs: (string[] | number[])[];
|
|
21
|
-
params: {
|
|
22
|
-
assendant: boolean;
|
|
23
|
-
};
|
|
24
|
-
result: string[];
|
|
25
|
-
})[];
|
|
26
|
-
description: string;
|
|
27
|
-
category: string[];
|
|
28
|
-
author: string;
|
|
29
|
-
repository: string;
|
|
30
|
-
license: string;
|
|
31
|
-
};
|
|
32
|
-
export default sortByValuesAgentInfo;
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
{
|
|
36
|
-
inputs: [
|
|
37
|
-
["banana", "orange", "lemon", "apple"],
|
|
38
|
-
[2, 5, 6, 4],
|
|
39
|
-
],
|
|
40
|
-
params: {},
|
|
41
|
-
result: ["lemon", "orange", "apple", "banana"],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
inputs: [
|
|
45
|
-
["banana", "orange", "lemon", "apple"],
|
|
46
|
-
[2, 5, 6, 4],
|
|
47
|
-
],
|
|
48
|
-
params: {
|
|
49
|
-
assendant: true,
|
|
50
|
-
},
|
|
51
|
-
result: ["banana", "apple", "orange", "lemon"],
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
description: "sortByValues Agent",
|
|
55
|
-
category: ["matrix"],
|
|
56
|
-
author: "Receptron team",
|
|
57
|
-
repository: "https://github.com/receptron/graphai",
|
|
58
|
-
license: "MIT",
|
|
59
|
-
};
|
|
60
|
-
exports.default = sortByValuesAgentInfo;
|
|
@@ -1,10 +0,0 @@
|
|
|
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,62 +0,0 @@
|
|
|
1
|
-
import { AgentFunction } from "../../index";
|
|
2
|
-
export declare const fetchAgent: AgentFunction<{
|
|
3
|
-
debug?: boolean;
|
|
4
|
-
type?: string;
|
|
5
|
-
returnErrorResult?: boolean;
|
|
6
|
-
}, any, any>;
|
|
7
|
-
declare const fetchAgentInfo: {
|
|
8
|
-
name: string;
|
|
9
|
-
agent: AgentFunction<{
|
|
10
|
-
debug?: boolean | undefined;
|
|
11
|
-
type?: string | undefined;
|
|
12
|
-
returnErrorResult?: boolean | undefined;
|
|
13
|
-
}, any, any>;
|
|
14
|
-
mock: AgentFunction<{
|
|
15
|
-
debug?: boolean | undefined;
|
|
16
|
-
type?: string | undefined;
|
|
17
|
-
returnErrorResult?: boolean | undefined;
|
|
18
|
-
}, any, any>;
|
|
19
|
-
samples: ({
|
|
20
|
-
inputs: (string | {
|
|
21
|
-
foo: string;
|
|
22
|
-
"x-myHeader"?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
"x-myHeader": string;
|
|
25
|
-
foo?: undefined;
|
|
26
|
-
})[];
|
|
27
|
-
params: {
|
|
28
|
-
debug: boolean;
|
|
29
|
-
};
|
|
30
|
-
result: {
|
|
31
|
-
method: string;
|
|
32
|
-
url: string;
|
|
33
|
-
headers: {
|
|
34
|
-
"x-myHeader": string;
|
|
35
|
-
"Content-Type"?: undefined;
|
|
36
|
-
};
|
|
37
|
-
body: undefined;
|
|
38
|
-
};
|
|
39
|
-
} | {
|
|
40
|
-
inputs: (string | {
|
|
41
|
-
foo: string;
|
|
42
|
-
} | undefined)[];
|
|
43
|
-
params: {
|
|
44
|
-
debug: boolean;
|
|
45
|
-
};
|
|
46
|
-
result: {
|
|
47
|
-
method: string;
|
|
48
|
-
url: string;
|
|
49
|
-
headers: {
|
|
50
|
-
"Content-Type": string;
|
|
51
|
-
"x-myHeader"?: undefined;
|
|
52
|
-
};
|
|
53
|
-
body: string;
|
|
54
|
-
};
|
|
55
|
-
})[];
|
|
56
|
-
description: string;
|
|
57
|
-
category: string[];
|
|
58
|
-
author: string;
|
|
59
|
-
repository: string;
|
|
60
|
-
license: string;
|
|
61
|
-
};
|
|
62
|
-
export default fetchAgentInfo;
|