autogen.agentchat.contrib.capabilities.teachability.Teachability
Teachability
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.
Teachability is designed to be composable with other agent capabilities.
To make any conversable agent teachable, instantiate both the agent and the Teachability class,
then pass the agent to teachability.add_to_agent(agent).
Note that teachable agents in a group chat must be given unique path_to_db_dir values.
When adding Teachability to an agent, the following are modified:
- The agent’s system message is appended with a note about the agent’s new ability.
- 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.
Added teachings do not propagate into the stored message history.
If new user teachings are detected, they are added to new memos in the vector database.
Name | Description |
---|---|
verbosity | Type: int | None Default: 0 |
reset_db | Type: bool | None Default: False |
path_to_db_dir | Type: str | None Default: ’./tmp/teachable_agent_db’ |
recall_threshold | The maximum distance for retrieved memos, where 0.0 is exact match. 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. Default 10.br/>llm_config (dict or False): llm inference configuration passed to TextAnalyzerAgent.br/> If None, TextAnalyzerAgent uses llm_config from the teachable agent. Type: float | None Default: 1.5 |
max_num_retrievals | Type: int | None Default: 10 |
llm_config | Type: dict[str, typing.Any] | bool | None Default: None |
Instance Methods
add_to_agent
Adds teachability to the given agent.
Parameters:Name | Description |
---|---|
agent | Type: ConversableAgent |
prepopulate_db
Adds a few arbitrary memos to the DB.
process_last_received_message
Appends any relevant memos to the message text, and stores any apparent teachings in new memos.
Uses TextAnalyzerAgent to make decisions about memo storage and retrieval.
Name | Description |
---|---|
text | Type: dict[str, typing.Any] | str |