Adding support to export tasks as json, pydantic objects, and save as file

This commit is contained in:
João Moura
2024-02-19 22:46:34 -03:00
parent efb097a76b
commit 108a0d36b7
3 changed files with 70 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Union
from pydantic import BaseModel, Field, model_validator
@@ -8,7 +8,10 @@ class TaskOutput(BaseModel):
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")
exported_output: Union[str, BaseModel] = Field(
description="Output of the task", default=None
)
raw_output: str = Field(description="Result of the task")
@model_validator(mode="after")
def set_summary(self):