> ## Documentation Index
> Fetch the complete documentation index at: https://nvd-54.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google scholar 集成

> 使用 LangChain JavaScript 集成 Google scholar tool。

This notebook provides a quick overview for getting started with [`SERPGoogleScholarTool`](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool). For detailed documentation of all `SERPGoogleScholarAPITool` features and configurations, head to the [API reference](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool).

## 概述

### 集成详情

| Class                                                                                                                               | Package                                                                      | [PY support](https://python.langchain.com/docs/integrations/tools/google_scholar/) |                                              Version                                              |
| :---------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | :--------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |
| [`GoogleScholarTool`](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool) | [`@langchain/community`](https://www.npmjs.com/package/@langchain/community) |                                          ✅                                         | ![NPM - Version](https://img.shields.io/npm/v/@langchain/community?style=flat-square\&label=%20&) |

### Tool features

* Retrieve academic publications by topic, author, or query.
* Fetch metadata such as title, author, and publication year.
* Advanced search filters, including citation count and journal name.

## 设置

The integration lives in the `@langchain/community` package.

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/community
```

### 凭证

Ensure you have the appropriate API key to access Google Scholar. Set it in your environment variables:

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
SERPAPI_API_KEY="your-serp-api-key"
```

It's also helpful to set up [LangSmith](https://smith.langchain.com?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=oss-javascript-integrations-tools-google_scholar) for best-in-class observability:

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
process.env.LANGSMITH_TRACING="true"
process.env.LANGSMITH_API_KEY="your-langchain-api-key"
```

## 实例化

You can import and instantiate an instance of the `SERPGoogleScholarAPITool` tool like this:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { SERPGoogleScholarAPITool } from "@langchain/community/tools/google_scholar";

const tool = new SERPGoogleScholarAPITool({
  apiKey: process.env.SERPAPI_API_KEY,
});
```

## 调用

### Invoke directly with args

You can invoke the tool directly with query arguments:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
const results = await tool.invoke({
  query: "neural networks",
  maxResults: 5,
});

console.log(results);
```

### Invoke with ToolCall

We can also invoke the tool with a model-generated `ToolCall`:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
const modelGeneratedToolCall = {
  args: { query: "machine learning" },
  id: "1",
  name: tool.name,
  type: "tool_call",
};
await tool.invoke(modelGeneratedToolCall);
```

***

## API 参考

有关所有 `SERPGoogleScholarAPITool` features and configurations, 的详细文档，请前往 [API 参考](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool)。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档连接到](/use-these-docs) Claude、VSCode 等工具，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/tools/google_scholar.mdx) 或 [提交 issue](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
