Skip to content

Commit aa0b887

Browse files
format
1 parent 05d00ad commit aa0b887

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

libs/langchain/src/agents/ReactAgent.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,7 @@ export class ReactAgent<
982982
return TOOLS_NODE_NAME;
983983
}
984984

985-
const regularToolCalls = (
986-
lastMessage as AIMessage
987-
).tool_calls!.filter(
985+
const regularToolCalls = (lastMessage as AIMessage).tool_calls!.filter(
988986
(toolCall) => !toolCall.name.startsWith("extract-")
989987
);
990988

libs/langchain/src/agents/tests/tools.test.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,21 @@ describe("tools", () => {
8585
],
8686
});
8787

88-
const toolA = tool(async () => {
89-
invocationOrder.push("tool_a");
90-
return "result_a";
91-
}, { name: "tool_a", description: "tool a", schema: z.object({}) });
88+
const toolA = tool(
89+
async () => {
90+
invocationOrder.push("tool_a");
91+
return "result_a";
92+
},
93+
{ name: "tool_a", description: "tool a", schema: z.object({}) }
94+
);
9295

93-
const toolB = tool(async () => {
94-
invocationOrder.push("tool_b");
95-
return "result_b";
96-
}, { name: "tool_b", description: "tool b", schema: z.object({}) });
96+
const toolB = tool(
97+
async () => {
98+
invocationOrder.push("tool_b");
99+
return "result_b";
100+
},
101+
{ name: "tool_b", description: "tool b", schema: z.object({}) }
102+
);
97103

98104
const agent = createAgent({
99105
model,
@@ -191,15 +197,21 @@ describe("tools", () => {
191197
],
192198
});
193199

194-
const toolA = tool(async () => {
195-
invocationOrder.push("tool_a");
196-
return "result_a";
197-
}, { name: "tool_a", description: "tool a", schema: z.object({}) });
200+
const toolA = tool(
201+
async () => {
202+
invocationOrder.push("tool_a");
203+
return "result_a";
204+
},
205+
{ name: "tool_a", description: "tool a", schema: z.object({}) }
206+
);
198207

199-
const toolB = tool(async () => {
200-
invocationOrder.push("tool_b");
201-
return "result_b";
202-
}, { name: "tool_b", description: "tool b", schema: z.object({}) });
208+
const toolB = tool(
209+
async () => {
210+
invocationOrder.push("tool_b");
211+
return "result_b";
212+
},
213+
{ name: "tool_b", description: "tool b", schema: z.object({}) }
214+
);
203215

204216
// afterModel middleware forces the #createAfterModelRouter code path
205217
const afterModelMiddleware = createMiddleware({

0 commit comments

Comments
 (0)