Documentation Index
Fetch the complete documentation index at: https://private-04b27de1.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.


- We introduce Teachable Agents so that users can teach their LLM-based assistants new facts, preferences, and skills.
- We showcase examples of teachable agents learning and later recalling facts, preferences, and skills in subsequent chats.
Introduction
Conversational assistants based on LLMs can remember the current chat with the user, and can also demonstrate in-context learning of user teachings during the conversation. But the assistant’s memories and learnings are lost once the chat is over, or when a single chat grows too long for the LLM to handle effectively. Then in subsequent chats the user is forced to repeat any necessary instructions over and over.Teachability addresses these limitations by persisting user teachings across chat boundaries in long-term memory implemented as a vector database. Instead of copying all of memory into the context window, which would eat up valuable space, individual memories (called memos) are retrieved into context as needed. This allows the user to teach frequently used facts and skills to the teachable agent just once, and have it recall them in later chats.
Any instantiated agent that inherits from ConversableAgent can be made teachable by instantiating a Teachability object and calling its add_to_agent(agent) method.
In order to make effective decisions about memo storage and retrieval, the Teachability object calls an instance of TextAnalyzerAgent (another AutoGen agent) to identify and reformulate text as needed for remembering facts, preferences, and skills. Note that this adds extra LLM calls involving a relatively small number of tokens, which can add a few seconds to the time a user waits for each response.
Run It Yourself
AutoGen contains four code examples that useTeachability.
- Run chat_with_teachable_agent.py to converse with a teachable agent.
- Run test_teachable_agent.py for quick unit testing of a teachable agent.
- Use the Jupyter notebook agentchat_teachability.ipynb to step through examples discussed below.
-
Use the Jupyter notebook agentchat_teachable_oai_assistants.ipynb to make arbitrary OpenAI Assistants teachable through
GPTAssistantAgent.
Basic Usage of Teachability
- Install dependencies
Teachability.
- Import agents
- Create llm_config
- Create the agents
- Chat with the teachable agent
Example 1 - Learning user info
A user can teach the agent facts about themselves. (Note that due to their finetuning, LLMs can be reluctant to admit that they know personal information.)Example 2 - Learning new facts
A user can teach the agent more complex, related facts.Example 3 - Learning user preferences
A user can teach the agent how they prefer to have things done. Be aware that a message like the next one cannot be entered as a single message through a command line because it contains a newline character. Such messages can be entered in a Jupyter notebook, or through some UI layer like that of ChatGPT.Example 4 - Learning new skills
Users can extend the teachable agent’s capabilities by teaching it new skills for accomplishing challenging tasks. It usually works best to first describe the task, then (in the same turn) provide a hint or advice for approaching the task. The Sparks of AGI paper evaluated GPT-4 on math problems like the following, which it could only solve 32% of the time. We first show a failure case, then teach the agent a strategy which lifts GPT-4’s success rate above 95%.Planned improvements
- Understanding user instructions distributed over multiple turns.
- Learning from the agent’s own experience, to reduce dependence on explicit user teachings.
- Learning skills built on top of previously learned skills.
Conclusion
Teachability is still under active research and development. For any problems you find or improvements you have in mind, please join our discussions in this repo and on our Discord channel. We look forward to seeing how you and the rest of the community can use and improve teachable agents in AutoGen!
