You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The assistant agent is built on top of the existing BaseAgent and serves as a simple interface for creating an AI assistant agent.
55
-
It provides a convenient way to define an AI assistant agent that can interact with users in a conversational manner.
56
-
The assistant agent can be customized with a name, language model, memory, and other parameters.
57
-
It also supports asynchronous mode, allowing it to handle multiple conversations simultaneously.
58
-
59
-
MultiagentManager can be used to manage multiple assistant agents and coordinate their interactions with users.
60
-
61
-
62
-
Example:
63
-
64
-
65
-
tailwind_agent = AssistantAgent(name='Tailwind Class Generator', llm=llm, memory=None, async_mode=False,
66
-
system_message='''automates the creation of Tailwind CSS classes, streamlining the process of building stylish and responsive user interfaces. By leveraging advanced algorithms and design principles, the Tailwind Class Generator analyzes your design elements and dynamically generates the optimal set of Tailwind utility classes.
67
-
This tool is designed to enhance efficiency in web development, allowing developers to focus more on high-level design decisions and less on manually crafting individual CSS rules. With the Tailwind Class Generator, achieving a visually appealing and consistent design becomes a seamless experience.
68
-
'''
69
-
)
70
-
"""
71
-
72
-
DEFAULT_PROMPT='''
73
-
{{#system~}} {{name}}, you are working in the following team :{{agents}}
74
-
{{~/system}}
75
-
76
-
{{#user~}}
77
-
Read the following CONVERSATION :
78
-
{{messages}}
79
-
Respond as {{name}}. Do not thank any team member or show appreciation."
80
-
{{~/user}}
81
-
82
-
{{#assistant~}}
83
-
{{gen 'answer' temperature=0 max_tokens=500}}
84
-
{{~/assistant}}
85
-
'''
86
-
87
-
def__init__(self,
88
-
name,
89
-
llm=None,
90
-
memory=None,
91
-
async_mode: bool=False,
92
-
system_message: str|None=None,
93
-
custom_engine=None,
94
-
functions_before_call: Tuple[Callable,
95
-
Tuple[Any], Tuple[Any]] |None=None,
96
-
functions_after_call: Tuple[Callable,
97
-
Tuple[Any], Tuple[Any]] |None=None,
98
-
description: str="Helpful AI Assistant Agent",
99
-
**kwargs):
100
-
"""
101
-
Initializes an instance of the AssistantAgent class.
102
-
103
-
:param name: The name of the assistant agent.
104
-
:type name: str
105
-
:param llm: The language model used by the assistant agent.
106
-
:type llm: LanguageModel
107
-
:param memory: The memory used by the assistant agent.
108
-
:type memory: Memory
109
-
:param async_mode: Whether the assistant agent should run in asynchronous mode or not. Default is True.
110
-
:type async_mode: bool, optional
111
-
:param system_message: The system message to be displayed to the user. Default is None.
112
-
:type system_message: str, optional
113
-
:param engine: The engine used by the assistant agent. Either llm or engine must be provided.
114
-
:type engine: Engine, optional
115
-
:param functions_before_call: List of functions, args and kwargs, to be called before the main function call. Default is None.
0 commit comments