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

# Wikipedia

**WikipediaTools** 使代理能够搜索维基百科网站并将内容添加到知识库中。

## 先决条件

以下示例需要 `wikipedia` 库。

```shell theme={null}
pip install -U wikipedia
```

## 示例

以下代理将搜索维基百科的“ai”并打印响应。

```python cookbook/tools/wikipedia_tools.py theme={null}
from agno.agent import Agent
from agno.tools.wikipedia import WikipediaTools

agent = Agent(tools=[WikipediaTools()], show_tool_calls=True)
agent.print_response("Search wikipedia for 'ai'")
```

## Toolkit 参数

| 名称               | 类型                       | 默认值 | 描述                               |
| ---------------- | ------------------------ | --- | -------------------------------- |
| `knowledge_base` | `WikipediaKnowledgeBase` | -   | 与维基百科关联的知识库，包含与维基百科内容相关的各种数据和资源。 |

## Toolkit 函数

| 函数名称                                         | 描述                            |
| -------------------------------------------- | ----------------------------- |
| `search_wikipedia_and_update_knowledge_base` | 此函数在维基百科中搜索主题，将结果添加到知识库并返回它们。 |
| `search_wikipedia`                           | 在维基百科中搜索查询。                   |

## 开发人员资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/wikipedia.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/wikipedia_tools.py)
