mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-26 16:48:13 +00:00
More changes and todos
This commit is contained in:
@@ -41,6 +41,14 @@ class CrewOutput(BaseModel):
|
|||||||
output_dict.update(self.pydantic.model_dump())
|
output_dict.update(self.pydantic.model_dump())
|
||||||
return output_dict
|
return output_dict
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
if self.pydantic and hasattr(self.pydantic, key):
|
||||||
|
return getattr(self.pydantic, key)
|
||||||
|
elif self.json_dict and key in self.json_dict:
|
||||||
|
return self.json_dict[key]
|
||||||
|
else:
|
||||||
|
raise KeyError(f"Key '{key}' not found in CrewOutput.")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.pydantic:
|
if self.pydantic:
|
||||||
return str(self.pydantic)
|
return str(self.pydantic)
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ from typing import Any, Callable, Dict, Generic, List, Set, Type, TypeVar, Union
|
|||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
# TODO: Allow people to pass results from one method to another and not just state
|
||||||
|
|
||||||
T = TypeVar("T", bound=Union[BaseModel, Dict[str, Any]])
|
T = TypeVar("T", bound=Union[BaseModel, Dict[str, Any]])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user