Skip to content

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
isamu committed May 10, 2024
1 parent 5532acf commit 97e98f1
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/agentFilters/test_filter_params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,53 @@ test("test filterParams on each agent", async () => {
bypassAgent: [{ agentServer: { baseUrl: "http://localhost:8081/nodeParameter/" } }, { agentServer: { baseUrl: "http://localhost:8081/nodeParameter2/" } }],
});
});


test("test filterParams on agent filter", async () => {
const graph_data = {
version: 0.3,
nodes: {
echo: {
agent: "echoAgent",
params: {
filterParams: true,
},
},
bypassAgent: {
agent: "bypassAgent",
inputs: [":echo"],
isResult: true,
},
},
};
const agentFilters = [
{
name: "httpAgentFilter",
agent: httpAgentFilter,
filterParams: {
agentServer: {
baseUrl: "http://localhost:8085/agentFilters/",
stream: true,
},
},
agentIds: ["echoAgent"],
},
{
name: "httpAgentFilter",
agent: httpAgentFilter,
filterParams: {
agentServer: {
baseUrl: "http://localhost:8085/agentFilters2/",
stream: true,
},
},
agentIds: ["echoAgent"],
},
];

const graph = new GraphAI({ ...graph_data }, { ...defaultTestAgents, ...callbackDictonary }, { agentFilters });

const result = await graph.run();
// console.log(JSON.stringify(result));
assert.deepStrictEqual(result, { bypassAgent: [{ agentServer: { baseUrl: "http://localhost:8085/agentFilters/", stream: true } }] });
});

0 comments on commit 97e98f1

Please sign in to comment.