Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More version03 2 #290

Merged
merged 11 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/agentFilters/test_simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const callbackDictonary = {};

test("test agent filter", async () => {
const graph_data = {
version: 0.2,
version: 0.3,
nodes: {
echo: {
agent: "echoAgent",
Expand All @@ -40,7 +40,7 @@ test("test agent filter", async () => {
},
bypassAgent: {
agent: "bypassAgent",
inputs: ["echo"],
inputs: [":echo"],
isResult: true,
},
},
Expand All @@ -64,7 +64,7 @@ test("test agent filter", async () => {

test("test agent filter with agent condition", async () => {
const graph_data = {
version: 0.2,
version: 0.3,
nodes: {
echo: {
agent: "echoAgent",
Expand All @@ -74,7 +74,7 @@ test("test agent filter with agent condition", async () => {
},
bypassAgent: {
agent: "bypassAgent",
inputs: ["echo"],
inputs: [":echo"],
isResult: true,
},
},
Expand All @@ -99,7 +99,7 @@ test("test agent filter with agent condition", async () => {

test("test agent filter with agent condition", async () => {
const graph_data = {
version: 0.2,
version: 0.3,
nodes: {
echo: {
agent: "echoAgent",
Expand All @@ -109,7 +109,7 @@ test("test agent filter with agent condition", async () => {
},
bypassAgent: {
agent: "bypassAgent",
inputs: ["echo"],
inputs: [":echo"],
isResult: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion tests/agentFilters/test_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const agentFilters = [
];

const graph_data = {
version: 0.2,
version: 0.3,
nodes: {
echo: {
agent: "echoAgent",
Expand Down
12 changes: 6 additions & 6 deletions tests/agents/test_map_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ test("test map_agent", async () => {
...defaultTestContext,
agents: { mapAgent, stringTemplateAgent },
graphData: {
version: 0.2,
version: 0.3,
nodes: {
node2: {
agent: "stringTemplateAgent",
params: {
template: "I love ${0}.",
},
inputs: ["$0.fruit"],
inputs: [":$0.fruit"],
isResult: true,
},
},
Expand All @@ -33,14 +33,14 @@ test("test map_agent 2", async () => {
...defaultTestContext,
agents: { mapAgent, stringTemplateAgent },
graphData: {
version: 0.2,
version: 0.3,
nodes: {
node2: {
agent: "stringTemplateAgent",
params: {
template: "I love ${0}.",
},
inputs: ["$0"],
inputs: [":$0"],
isResult: true,
},
},
Expand All @@ -57,14 +57,14 @@ test("test map_agent 3", async () => {
...defaultTestContext,
agents: { mapAgent, stringTemplateAgent },
graphData: {
version: 0.2,
version: 0.3,
nodes: {
node2: {
agent: "stringTemplateAgent",
params: {
template: "${1} ${2} ${0}.",
},
inputs: ["$0", "$1", "$2"],
inputs: [":$0", ":$1", ":$2"],
isResult: true,
},
},
Expand Down
8 changes: 4 additions & 4 deletions tests/agents/test_nest_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ test("test nest agent", async () => {
...defaultTestContext,
agents: { sleeperAgent },
graphData: {
version: 0.2,
version: 0.3,
nodes: {
node1: {
agent: "sleeperAgent",
inputs: ["$0", "$1", "$2"],
inputs: [":$0", ":$1", ":$2"],
isResult: true,
},
},
Expand All @@ -26,11 +26,11 @@ test("test nest agent", async () => {
});

const dynamic_graph = {
version: 0.2,
version: 0.3,
nodes: {
node1: {
agent: "sleeperAgent",
inputs: ["$1", "$2", "$3"],
inputs: [":$1", ":$2", ":$3"],
isResult: true,
},
},
Expand Down
4 changes: 2 additions & 2 deletions tests/graphai/test_inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import test from "node:test";
import assert from "node:assert";

const graphdata_inputs = {
version: 0.2,
version: 0.3,
nodes: {
apple: {
value: { fruits: { apple: "red" } },
Expand All @@ -15,7 +15,7 @@ const graphdata_inputs = {
},
total: {
agent: "sleeperAgent",
inputs: ["apple", "lemon", "apple.fruits", "lemon.fruits"],
inputs: [":apple", ":lemon", ":apple.fruits", ":lemon.fruits"],
},
},
};
Expand Down
18 changes: 9 additions & 9 deletions tests/graphai/test_loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import test from "node:test";
import assert from "node:assert";

const graphdata_push = {
version: 0.2,
version: 0.3,
loop: {
count: 10,
},
nodes: {
array: {
value: [],
update: "reducer",
update: ":reducer",
},
item: {
agent: "sleeperAgent",
Expand All @@ -25,7 +25,7 @@ const graphdata_push = {
reducer: {
isResult: true,
agent: "pushAgent",
inputs: ["array", "item"],
inputs: [":array", ":item"],
},
},
};
Expand All @@ -40,26 +40,26 @@ test("test loop & push", async () => {
});

const graphdata_pop = {
version: 0.2,
version: 0.3,
loop: {
while: "source",
while: ":source",
},
nodes: {
source: {
value: ["orange", "banana", "lemon"],
update: "popper.array",
update: ":popper.array",
},
result: {
value: [],
update: "reducer",
update: ":reducer",
},
popper: {
inputs: ["source"],
inputs: [":source"],
agent: "popAgent", // returns { array, item }
},
reducer: {
agent: "pushAgent",
inputs: ["result", "popper.item"],
inputs: [":result", ":popper.item"],
},
},
};
Expand Down
22 changes: 11 additions & 11 deletions tests/graphai/test_loop_2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import test from "node:test";
import assert from "node:assert";

const graphdata_counter = {
version: 0.2,
version: 0.3,
loop: {
count: 10,
},
nodes: {
data: {
value: { v: 0 },
update: "counter",
update: ":counter",
},
counter: {
agent: "counterAgent",
inputs: ["data"],
inputs: [":data"],
isResult: true,
},
},
Expand All @@ -36,14 +36,14 @@ test("test counter", async () => {

test("test counter2", async () => {
const nested_graphdata = {
version: 0.2,
version: 0.3,
loop: {
count: 10,
},
nodes: {
workingMemory: {
value: {},
update: "nested1.counter", // update data from nested1 data
update: ":nested1.counter", // update data from nested1 data
},
nested1: {
agent: "nestedAgent",
Expand All @@ -52,7 +52,7 @@ test("test counter2", async () => {
params: {
injectionTo: ["data"], // inject workingMemory data to data node in graphdata_counter
},
inputs: ["workingMemory"],
inputs: [":workingMemory"],
},
},
};
Expand All @@ -66,32 +66,32 @@ test("test counter2", async () => {

test("test counter3", async () => {
const nested_graphdata = {
version: 0.2,
version: 0.3,
concurrency: 2,
loop: {
count: 10,
},
nodes: {
workingMemory: {
value: {},
update: "merge", // update data from nested1 data
update: ":merge", // update data from nested1 data
},
workingMemory2: {
// HACK until we fix the bug (inputs:["workingMemory", "workingMemory"])
agent: "totalAgent",
inputs: ["workingMemory"],
inputs: [":workingMemory"],
},
mapping: {
agent: "mapAgent",
inputs: ["workingMemory", "workingMemory2"],
inputs: [":workingMemory", ":workingMemory2"],
params: {
injectionTo: ["data"],
},
graph: graphdata_counter,
},
merge: {
agent: "totalAgent",
inputs: ["mapping.counter"],
inputs: [":mapping.counter"],
},
},
};
Expand Down
Loading