Skip to content

Commit

Permalink
Merge pull request #907 from isamu/updateToolsResult
Browse files Browse the repository at this point in the history
Update tools result
  • Loading branch information
isamu authored Jan 28, 2025
2 parents eeaceea + e20b91e commit 6b808fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
8 changes: 6 additions & 2 deletions llm_agents/tools_agent/lib/tools_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ const toolWorkFlowStep = {
inputs: { array: [":textMessage.messages", ":tool_call_response.mergeToolsResponse.array.$0"] },
},
reducer: {
isResult: true,
agent: "pushAgent",
inputs: { array: ":messages", items: ":buffer.array.$0" },
},
result: {
agent: "copyAgent",
isResult: true,
inputs: { messages: ":reducer.array" }
},
},
};
const toolsAgent = (0, generator_1.nestedAgentGenerator)(toolWorkFlowStep);
const toolsAgent = (0, generator_1.nestedAgentGenerator)(toolWorkFlowStep, { resultNodeId: "result" });
const toolsAgentInfo = {
name: "toolsAgent",
agent: toolsAgent,
Expand Down
2 changes: 1 addition & 1 deletion llm_agents/tools_agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphai/tools_agent",
"version": "0.2.1",
"version": "0.2.2",
"description": "General tools agents",
"main": "lib/index.js",
"files": [
Expand Down
8 changes: 6 additions & 2 deletions llm_agents/tools_agent/src/tools_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ const toolWorkFlowStep = {
inputs: { array: [":textMessage.messages", ":tool_call_response.mergeToolsResponse.array.$0"] },
},
reducer: {
isResult: true,
agent: "pushAgent",
inputs: { array: ":messages", items: ":buffer.array.$0" },
},
result: {
agent: "copyAgent",
isResult: true,
inputs: { messages: ":reducer.array"}
},
},
};

const toolsAgent = nestedAgentGenerator(toolWorkFlowStep);
const toolsAgent = nestedAgentGenerator(toolWorkFlowStep, {resultNodeId: "result"});

const toolsAgentInfo = {
name: "toolsAgent",
Expand Down
3 changes: 2 additions & 1 deletion llm_agents/tools_agent/tests/run_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const main = async (agentInfo: AgentFunctionInfo) => {
const { agent, samples, inputs: inputSchema } = agentInfo;
for await (const sampleKey of samples.keys()) {
const { params, inputs } = samples[sampleKey];
await agent({
const result = await agent({
...defaultTestContext,
params,
inputSchema,
Expand All @@ -34,6 +34,7 @@ const main = async (agentInfo: AgentFunctionInfo) => {
graphOptions: {},
},
});
console.log(result);
}
};

Expand Down

0 comments on commit 6b808fb

Please sign in to comment.