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

# Google Scholar 集成

> 使用 LangChain JavaScript 集成 Google Scholar 工具。

本笔记本提供了快速入门 [`SERPGoogleScholarTool`](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool) 的简要概述。有关 `SERPGoogleScholarAPITool` 所有功能和配置的详细文档，请前往 [API 参考](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool)。

## 概述

### 集成详情

| 类                                                                                                                                   | 包                                                                            | [Python 支持](https://python.langchain.com/docs/integrations/tools/google_scholar/) |                                                 版本                                                |
| :---------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | :-------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |
| [`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&) |

### 工具特性

* 按主题、作者或查询检索学术出版物。
* 获取元数据，如标题、作者和出版年份。
* 高级搜索过滤器，包括引用次数和期刊名称。

## 设置

该集成位于 `@langchain/community` 包中。

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

### 凭证

确保您拥有访问 Google Scholar 的适当 API 密钥。请将其设置在环境变量中：

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

同时，建议设置 [LangSmith](https://smith.langchain.com/) 以获得一流的可观测性：

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

## 实例化

您可以像这样导入并实例化 `SERPGoogleScholarAPITool` 工具：

```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,
});
```

## 调用

### 直接使用参数调用

您可以直接使用查询参数调用该工具：

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

console.log(results);
```

### 使用 ToolCall 调用

我们也可以使用模型生成的 `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` 所有功能和配置的详细文档，请前往 [API 参考](https://reference.langchain.com/javascript/langchain-community/tools/google_scholar/SERPGoogleScholarAPITool)。

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\oss\javascript\integrations\tools\google_scholar.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
