-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lorenzejay/byoa #776
Lorenzejay/byoa #776
Conversation
…nd added to the crew agent doc page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to go through the review, but I think we can connect to discuss the idea of a single Agent interface that would prevent us from doing if agent is this
and if agent is that
.
def __init__(__pydantic_self__, **data): | ||
config = data.pop("config", {}) | ||
super().__init__(**config, **data) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we aren't going to make gpt-4o the default llm for everything. We need to add a model_validator that checks to make sure the agent has an LLM and isn't none.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Other agents may not be supporting 4o yet. but I do think a validator for llm not being none is best.
tools_list = [] | ||
try: | ||
# tentatively try to import from crewai_tools import BaseTool as CrewAITool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorenzejay , drop this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to me: from crewai_tools import BaseTool as CrewAITool
if not self._rpm_controller: | ||
self._rpm_controller = rpm_controller | ||
self.create_agent_executor() | ||
def format_log_to_str( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorenzejay should this be a ABC in BaseAgent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done abstractmethod set
|
||
return copied_agent | ||
def get_output_converter(self, llm, text, model, instructions): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a ABC in BaseAgent as well?
74bf476
to
680f17c
Compare
class CrewAgentExecutorMixin: | ||
def _should_force_answer(self) -> bool: | ||
return ( | ||
self.iterations == self.force_answer_max_iterations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these attributes exist on this class. You need to move these attributes over from executor.py and delete them over there.
|
||
def _create_short_term_memory(self, output) -> None: | ||
if ( | ||
self.crew |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to move over crew to this class instead of executor.py.
|
||
def _create_long_term_memory(self, output) -> None: | ||
if self.crew and self.crew.memory: | ||
ltm_agent = TaskEvaluator(self.crew_agent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to move over crew_agent from executor.py.
coworker = self._get_coworker(coworker, **kwargs) | ||
return self._execute(coworker, question, context) | ||
|
||
def _execute(self, agent_role: Optional[str], task: str, context: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main does not have these changes. think we can this later ?
src/crewai/crew.py
Outdated
@@ -435,17 +446,23 @@ def _run_hierarchical_process(self) -> Union[str, Dict[str, Any]]: | |||
) | |||
|
|||
self._logger.log("debug", f"[{manager.role}] Task output: {task_output}") | |||
|
|||
if hasattr(task.agent, "_token_process"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WHy do we have to do this check in hierarchical but not sequential?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attachment of an agent and task not required will give NoneTypes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heirarchial does not need an agent in task
@@ -302,14 +302,13 @@ def _export_output(self, result: str) -> Any: | |||
pass | |||
|
|||
# type: ignore # Item "None" of "Agent | None" has no attribute "function_calling_llm" | |||
llm = self.agent.function_calling_llm or self.agent.llm | |||
|
|||
llm = getattr(self.agent, "function_calling_llm", None) or self.agent.llm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent us from making these checks. Maybe we could update the base_agent to have a function_calling_llm
but it would be set to None.
this ticket aims to bring your own AI agent whether its a custom langchain one or one like llamaindex and still work with crew or any custom agent.
BaseAgent
as an abstraction to adhere to the crew flow.