(
self,
role_name: str,
objective: Union[str, TextPrompt],
model: Optional[BaseModelBackend] = None,
output_language: Optional[str] = None,
message_window_size: Optional[int] = None,
max_task_num: Optional[int] = 3,
)
| 226 | """ |
| 227 | |
| 228 | def __init__( |
| 229 | self, |
| 230 | role_name: str, |
| 231 | objective: Union[str, TextPrompt], |
| 232 | model: Optional[BaseModelBackend] = None, |
| 233 | output_language: Optional[str] = None, |
| 234 | message_window_size: Optional[int] = None, |
| 235 | max_task_num: Optional[int] = 3, |
| 236 | ) -> None: |
| 237 | task_creation_prompt = TextPrompt( |
| 238 | """Create new a task with the following objective: {objective}. |
| 239 | Never forget you are a Task Creator of {role_name}. |
| 240 | You must instruct me based on my expertise and your needs to solve the task. |
| 241 | You should consider past solved tasks and in-progress tasks: {task_list}. |
| 242 | The new created tasks must not overlap with these past tasks. |
| 243 | The result must be a numbered list in the format: |
| 244 | |
| 245 | #. First Task |
| 246 | #. Second Task |
| 247 | #. Third Task |
| 248 | |
| 249 | You can only give me up to {max_task_num} tasks at a time. \ |
| 250 | Each task should be concise, concrete and doable for a {role_name}. |
| 251 | You should make task plan and not ask me questions. |
| 252 | If you think no new tasks are needed right now, write "No tasks to add." |
| 253 | Now start to give me new tasks one by one. No more than three tasks. |
| 254 | Be concrete. |
| 255 | """ |
| 256 | ) |
| 257 | |
| 258 | self.task_creation_prompt = task_creation_prompt.format( |
| 259 | objective=objective, role_name=role_name, max_task_num=max_task_num |
| 260 | ) |
| 261 | self.objective = objective |
| 262 | |
| 263 | system_message = BaseMessage( |
| 264 | role_name="Task Creator", |
| 265 | role_type=RoleType.ASSISTANT, |
| 266 | meta_dict=None, |
| 267 | content="You are a helpful task creator.", |
| 268 | ) |
| 269 | |
| 270 | super().__init__( |
| 271 | system_message, |
| 272 | model=model, |
| 273 | output_language=output_language, |
| 274 | message_window_size=message_window_size, |
| 275 | ) |
| 276 | |
| 277 | def run( |
| 278 | self, |
nothing calls this directly
no test coverage detected