> ## 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.agentchat.contrib.capabilities.teachability.Teachability

<h2 id="autogen.agentchat.contrib.capabilities.teachability.Teachability" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

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

```python theme={null}
Teachability(
    verbosity: int | None = 0,
    reset_db: bool | None = False,
    path_to_db_dir: str | None = './tmp/teachable_agent_db',
    recall_threshold: float | None = 1.5,
    max_num_retrievals: int | None = 10,
    llm_config: LLMConfig | dict[str, Any] | bool | None = None
)
```

Teachability uses a vector database to give an agent the ability to remember user teachings,
where the user is any caller (human or not) sending messages to the teachable agent.<br />Teachability is designed to be composable with other agent capabilities.<br />To make any conversable agent teachable, instantiate both the agent and the Teachability class,
then pass the agent to teachability.add\_to\_agent(agent).<br />Note that teachable agents in a group chat must be given unique path\_to\_db\_dir values.<br />When adding Teachability to an agent, the following are modified: <br />- The agent's system message is appended with a note about the agent's new ability.<br />- A hook is added to the agent's `process_last_received_message` hookable method,
and the hook potentially modifies the last of the received messages to include earlier teachings related to the message.<br />Added teachings do not propagate into the stored message history.<br />If new user teachings are detected, they are added to new memos in the vector database.<br />

<b>Parameters:</b>

| Name                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `verbosity`          | **Type:** int \| None<br /><br />**Default:** 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `reset_db`           | **Type:** bool \| None<br /><br />**Default:** False                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `path_to_db_dir`     | **Type:** str \| None<br /><br />**Default:** './tmp/teachable\_agent\_db'                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `recall_threshold`   | The maximum distance for retrieved memos, where 0.0 is exact match.<br /><br />Default 1.5. Larger values allow more (but less relevant) memos to be recalled.br/>max\_num\_retrievals (Optional, int): The maximum number of memos to retrieve from the DB.<br /><br />Default 10.br/>llm\_config (LLMConfig or dict or False): llm inference configuration passed to TextAnalyzerAgent.br/> If None, TextAnalyzerAgent uses llm\_config from the teachable agent.<br /><br />**Type:** float \| None<br /><br />**Default:** 1.5 |
| `max_num_retrievals` | **Type:** int \| None<br /><br />**Default:** 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `llm_config`         | **Type:** [LLMConfig](/docs/api-reference/autogen/llm_config/LLMConfig) \| dict\[str, typing.Any] \| bool \| None<br /><br />**Default:** None                                                                                                                                                                                                                                                                                                                                                                                     |

### Instance Methods

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

#### add\_to\_agent

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

Adds teachability to the given agent.

<b>Parameters:</b>

| Name    | Description                                                                |
| ------- | -------------------------------------------------------------------------- |
| `agent` | **Type:** [ConversableAgent](/docs/api-reference/autogen/ConversableAgent) |

<br />

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

#### prepopulate\_db

```python theme={null}
prepopulate_db(self) -> 
```

Adds a few arbitrary memos to the DB.

<br />

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

#### process\_last\_received\_message

```python theme={null}
process_last_received_message(self, text: dict[str, Any] | str) -> 
```

Appends any relevant memos to the message text, and stores any apparent teachings in new memos.<br />Uses TextAnalyzerAgent to make decisions about memo storage and retrieval.

<b>Parameters:</b>

| Name   | Description                             |
| ------ | --------------------------------------- |
| `text` | **Type:** dict\[str, typing.Any] \| str |

<br />
