diff --git a/libs/langchain-anthropic/src/tests/chat_models-tools.int.test.ts b/libs/langchain-anthropic/src/tests/chat_models-tools.int.test.ts index bdf38b64b63e..a6cbdcbd956b 100644 --- a/libs/langchain-anthropic/src/tests/chat_models-tools.int.test.ts +++ b/libs/langchain-anthropic/src/tests/chat_models-tools.int.test.ts @@ -364,19 +364,25 @@ test("bindTools accepts openai formatted tool", async () => { }); test("withStructuredOutput will always force tool usage", async () => { - const weatherTool = z.object({ - location: z.string().describe("The name of city to get the weather for."), - }).describe("Get the weather of a specific location and return the temperature in Celsius.") + const weatherTool = z + .object({ + location: z.string().describe("The name of city to get the weather for."), + }) + .describe( + "Get the weather of a specific location and return the temperature in Celsius." + ); const modelWithTools = model.withStructuredOutput(weatherTool, { name: "get_weather", - includeRaw: true + includeRaw: true, }); - const response = await modelWithTools.invoke("What is the sum of 271623 and 281623? It is VERY important you use a calculator tool to give me the answer."); + const response = await modelWithTools.invoke( + "What is the sum of 271623 and 281623? It is VERY important you use a calculator tool to give me the answer." + ); if (!("tool_calls" in response.raw)) { - throw new Error("Tool call not found in response") + throw new Error("Tool call not found in response"); } const castMessage = response.raw as AIMessage; expect(castMessage.tool_calls).toHaveLength(1); expect(castMessage.tool_calls?.[0].name).toBe("get_weather"); -}) \ No newline at end of file +});