diff --git a/docs/core_docs/docs/integrations/tools/google_scholar.ipynb b/docs/core_docs/docs/integrations/tools/google_scholar.ipynb index 32cf8ed0fc7e..ed6539459e1d 100644 --- a/docs/core_docs/docs/integrations/tools/google_scholar.ipynb +++ b/docs/core_docs/docs/integrations/tools/google_scholar.ipynb @@ -82,7 +82,7 @@ }, "outputs": [], "source": [ - "import { SERPGoogleScholarAPITool } from \"@langchain/community\";\n", + "import { SERPGoogleScholarAPITool } from \"@langchain/community/tools/google_scholar\";\n", "\n", "const tool = new SERPGoogleScholarAPITool({\n", " apiKey: process.env.SERPAPI_API_KEY,\n", diff --git a/libs/langchain-community/src/tools/tests/google_scholar.int.test.ts b/libs/langchain-community/src/tools/tests/google_scholar.int.test.ts index 14c0bfe8e442..0f6f19d45158 100644 --- a/libs/langchain-community/src/tools/tests/google_scholar.int.test.ts +++ b/libs/langchain-community/src/tools/tests/google_scholar.int.test.ts @@ -1,17 +1,18 @@ import { test, expect, describe } from "@jest/globals"; import { SERPGoogleScholarAPITool } from "../google_scholar.js"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; describe("SERPGoogleScholarAPITool", () => { test("should be setup with correct parameters", async () => { const instance = new SERPGoogleScholarAPITool({ - apiKey: process.env.SERPAPI_API_KEY, + apiKey: getEnvironmentVariable("SERPAPI_API_KEY"), }); expect(instance.name).toBe("serp_google_scholar"); }); test("SERPGoogleScholarAPITool returns a string for valid query", async () => { const tool = new SERPGoogleScholarAPITool({ - apiKey: process.env.SERPAPI_API_KEY, + apiKey: getEnvironmentVariable("SERPAPI_API_KEY"), }); const result = await tool.invoke("Artificial Intelligence"); expect(typeof result).toBe("string"); @@ -19,7 +20,7 @@ describe("SERPGoogleScholarAPITool", () => { test("SERPGoogleScholarAPITool returns non-empty string for valid query", async () => { const tool = new SERPGoogleScholarAPITool({ - apiKey: process.env.SERPAPI_API_KEY, + apiKey: getEnvironmentVariable("SERPAPI_API_KEY"), }); const result = await tool.invoke("Artificial Intelligence"); expect(result.length).toBeGreaterThan(0); @@ -27,7 +28,7 @@ describe("SERPGoogleScholarAPITool", () => { test("SERPGoogleScholarAPITool returns 'No results found' for bad query", async () => { const tool = new SERPGoogleScholarAPITool({ - apiKey: process.env.SERPAPI_API_KEY, + apiKey: getEnvironmentVariable("SERPAPI_API_KEY"), }); const result = await tool.invoke("dsalkfjsdlfjasdflasdl"); expect(result).toBe(