mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-25 16:18:13 +00:00
feat: type checking gic
This commit is contained in:
@@ -3,7 +3,13 @@ import re
|
|||||||
from typing import Any, Dict, List, Union
|
from typing import Any, Dict, List, Union
|
||||||
|
|
||||||
from crewai.agents.agent_builder.base_agent_executor_mixin import CrewAgentExecutorMixin
|
from crewai.agents.agent_builder.base_agent_executor_mixin import CrewAgentExecutorMixin
|
||||||
from crewai.agents.parser import CrewAgentParser
|
from crewai.agents.parser import (
|
||||||
|
FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE,
|
||||||
|
AgentAction,
|
||||||
|
AgentFinish,
|
||||||
|
CrewAgentParser,
|
||||||
|
OutputParserException,
|
||||||
|
)
|
||||||
from crewai.agents.tools_handler import ToolsHandler
|
from crewai.agents.tools_handler import ToolsHandler
|
||||||
from crewai.tools.tool_usage import ToolUsage, ToolUsageErrorException
|
from crewai.tools.tool_usage import ToolUsage, ToolUsageErrorException
|
||||||
from crewai.utilities import I18N, Printer
|
from crewai.utilities import I18N, Printer
|
||||||
@@ -13,12 +19,6 @@ from crewai.utilities.exceptions.context_window_exceeding_exception import (
|
|||||||
)
|
)
|
||||||
from crewai.utilities.logger import Logger
|
from crewai.utilities.logger import Logger
|
||||||
from crewai.utilities.training_handler import CrewTrainingHandler
|
from crewai.utilities.training_handler import CrewTrainingHandler
|
||||||
from crewai.agents.parser import (
|
|
||||||
AgentAction,
|
|
||||||
AgentFinish,
|
|
||||||
OutputParserException,
|
|
||||||
FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CrewAgentExecutor(CrewAgentExecutorMixin):
|
class CrewAgentExecutor(CrewAgentExecutorMixin):
|
||||||
@@ -313,9 +313,10 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
):
|
):
|
||||||
training_data = CrewTrainingHandler(TRAINING_DATA_FILE).load()
|
training_data = CrewTrainingHandler(TRAINING_DATA_FILE).load()
|
||||||
if training_data.get(agent_id):
|
if training_data.get(agent_id):
|
||||||
training_data[agent_id][self.crew._train_iteration][
|
if self.crew is not None and hasattr(self.crew, "_train_iteration"):
|
||||||
"improved_output"
|
training_data[agent_id][self.crew._train_iteration][
|
||||||
] = result.output
|
"improved_output"
|
||||||
|
] = result.output
|
||||||
CrewTrainingHandler(TRAINING_DATA_FILE).save(training_data)
|
CrewTrainingHandler(TRAINING_DATA_FILE).save(training_data)
|
||||||
|
|
||||||
if self.ask_for_human_input and human_feedback is not None:
|
if self.ask_for_human_input and human_feedback is not None:
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ def crew(func) -> Callable[..., "Crew"]:
|
|||||||
|
|
||||||
# Sort tasks by their registration order
|
# Sort tasks by their registration order
|
||||||
sorted_task_names = sorted(
|
sorted_task_names = sorted(
|
||||||
tasks, key=lambda name: task.registration_order.index(name)
|
tasks,
|
||||||
|
key=lambda name: task.registration_order.index(name), # type: ignore
|
||||||
)
|
)
|
||||||
|
|
||||||
# Instantiate tasks in the order they were defined
|
# Instantiate tasks in the order they were defined
|
||||||
|
|||||||
Reference in New Issue
Block a user