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

# autogen.tools.experimental.wikipedia.WikipediaPageLoadTool

<h2 id="autogen.tools.experimental.wikipedia.WikipediaPageLoadTool" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">WikipediaPageLoadTool</span>
</h2>

```python theme={null}
WikipediaPageLoadTool(
    language: str = 'en',
    top_k: int = 3,
    truncate: int = 4000,
    verbose: bool = False
)
```

A tool to load up to N characters of Wikipedia page content along with metadata.<br />This tool uses a language-specific Wikipedia client to search for relevant articles
and returns a list of Document objects containing truncated page content and metadata
(source URL, title, page ID, timestamp, word count, and size). Ideal for agents
requiring structured Wikipedia data for research, summarization, or contextual enrichment.<br />Attributes: <br />    language (str): Wikipedia language code (default: "en").<br />    top\_k (int): Maximum number of pages to retrieve per query (default: 3).<br />    truncate (int): Maximum number of characters of content per page (default: 4000).<br />    verbose (bool): If True, prints debug information (default: False).<br />    tool\_name (str): Identifier used in User-Agent header.<br />    wiki\_cli (WikipediaClient): Client for interacting with the Wikipedia API.<br />Initializes the WikipediaPageLoadTool with configurable language, result count, and content length.<br />

<b>Parameters:</b>

| Name       | Description                                  |
| ---------- | -------------------------------------------- |
| `language` | **Type:** str<br /><br />**Default:** 'en'   |
| `top_k`    | **Type:** int<br /><br />**Default:** 3      |
| `truncate` | **Type:** int<br /><br />**Default:** 4000   |
| `verbose`  | **Type:** bool<br /><br />**Default:** False |

### Instance Attributes

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### description

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### func

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### function\_schema

<br />

Get the schema for the function.<br />This is the old way of handling function calls with OpenAI and compatible frameworks.<br />It is provided for backward compatibility.

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### name

<br />

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### realtime\_tool\_schema

<br />

Get the schema for the tool.<br />This is the preferred way of handling function calls with OpeaAI and compatible frameworks.

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### tool\_schema

<br />

Get the schema for the tool.<br />This is the preferred way of handling function calls with OpeaAI and compatible frameworks.

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### content\_search

```python theme={null}
content_search(self, query: str) -> list[Document] | str
```

Executes a Wikipedia search and returns page content plus metadata.<br />

<b>Parameters:</b>

| Name    | Description                                                  |
| ------- | ------------------------------------------------------------ |
| `query` | The search term to query Wikipedia.<br /><br />**Type:** str |

<b>Returns:</b>

| Type                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| list\[[Document](/docs/api-reference/autogen/tools/experimental/wikipedia/wikipedia/Document)] \| str | Union\[list\[Document], str]: - list\[Document]: Documents with up to `truncate` characters of page text and metadata if pages are found. - str: Error message if the search fails or no pages are found. Notes: - Errors are caught internally and returned as strings. - If no matching pages have text content, returns "No good Wikipedia Search Result was found". |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### register\_for\_execution

```python theme={null}
register_for_execution(self, agent: ConversableAgent) -> 
```

Registers the tool for direct execution by a ConversableAgent.<br />This method registers the tool so that it can be executed by the agent,
typically outside of the context of an LLM interaction.<br />

<b>Parameters:</b>

| Name    | Description                                                                           |
| ------- | ------------------------------------------------------------------------------------- |
| `agent` | The agent to which the tool will be registered.<br /><br />**Type:** ConversableAgent |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### register\_for\_llm

```python theme={null}
register_for_llm(self, agent: ConversableAgent) -> 
```

Registers the tool for use with a ConversableAgent's language model (LLM).<br />This method registers the tool so that it can be invoked by the agent during
interactions with the language model.<br />

<b>Parameters:</b>

| Name    | Description                                                                           |
| ------- | ------------------------------------------------------------------------------------- |
| `agent` | The agent to which the tool will be registered.<br /><br />**Type:** ConversableAgent |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### register\_tool

```python theme={null}
register_tool(self, agent: ConversableAgent) -> 
```

Register a tool to be both proposed and executed by an agent.<br />Equivalent to calling both `register_for_llm` and `register_for_execution` with the same agent.<br />Note: This will not make the agent recommend and execute the call in the one step. If the agent
recommends the tool, it will need to be the next agent to speak in order to execute the tool.<br />

<b>Parameters:</b>

| Name    | Description                                                                           |
| ------- | ------------------------------------------------------------------------------------- |
| `agent` | The agent to which the tool will be registered.<br /><br />**Type:** ConversableAgent |

<br />
