Files
crewAI/crewai/tasks/task_output.py
João Moura 7954f6b51c Reliability improvements (#77)
* fixing identation for AgentTools
* updating gitignore to exclude quick test script
* startingprompt translation
* supporting individual task output
* adding agent to task output
* cutting new version
* Updating README example
2024-01-07 12:43:23 -03:00

18 lines
564 B
Python

from typing import Optional
from pydantic import BaseModel, Field, model_validator
class TaskOutput(BaseModel):
"""Class that represents the result of a task."""
description: str = Field(description="Description of the task")
summary: Optional[str] = Field(description="Summary of the task", default=None)
result: str = Field(description="Result of the task")
@model_validator(mode="after")
def set_summary(self):
excerpt = " ".join(self.description.split(" ")[0:10])
self.summary = f"{excerpt}..."
return self