Skip to content

Commit

Permalink
chore: lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jul 30, 2024
1 parent ae40d44 commit 56e1425
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion langchain-core/src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export abstract class StructuredTool<
let status: "success" | "error" = "success";
try {
result = await this._call(parsed, runManager, config);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
await runManager?.handleToolError(e);
if (!this.continueOnError) {
Expand Down
25 changes: 14 additions & 11 deletions langchain-core/src/tools/tests/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,18 @@ test("Tool can accept single string input", async () => {
});

test("Tool can continue if an error is thrown", async () => {
const errorTool = tool((_) => {
throw new Error("This tool encountered an error.");
}, {
name: "error_tool",
schema: z.object({
input: z.string(),
}),
continueOnError: true,
})
const errorTool = tool(
(_) => {
throw new Error("This tool encountered an error.");
},
{
name: "error_tool",
schema: z.object({
input: z.string(),
}),
continueOnError: true,
}
);

const result = await errorTool.invoke({
id: "testid",
Expand All @@ -138,5 +141,5 @@ test("Tool can continue if an error is thrown", async () => {
expect(JSON.parse(result.content)).toEqual({
code: undefined,
message: "This tool encountered an error.",
})
});
});
});

0 comments on commit 56e1425

Please sign in to comment.