mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 23:32:39 +00:00
improving types
This commit is contained in:
@@ -98,7 +98,7 @@ class Agent(BaseAgent):
|
|||||||
allow_code_execution: Optional[bool] = Field(
|
allow_code_execution: Optional[bool] = Field(
|
||||||
default=False, description="Enable code execution for the agent."
|
default=False, description="Enable code execution for the agent."
|
||||||
)
|
)
|
||||||
respect_context_window: Optional[bool] = Field(
|
respect_context_window: bool = Field(
|
||||||
default=True,
|
default=True,
|
||||||
description="Keep messages under the context window size by summarizing content.",
|
description="Keep messages under the context window size by summarizing content.",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
task: Any,
|
task: Any,
|
||||||
crew: Any,
|
crew: Any,
|
||||||
agent: Any,
|
agent: Any,
|
||||||
prompt: str,
|
prompt: dict[str, str],
|
||||||
max_iter: int,
|
max_iter: int,
|
||||||
tools: List[Any],
|
tools: List[Any],
|
||||||
tools_names: str,
|
tools_names: str,
|
||||||
@@ -260,5 +260,5 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
def _format_answer(self, answer: str) -> str:
|
def _format_answer(self, answer: str) -> str:
|
||||||
return CrewAgentParser(agent=self.agent).parse(answer)
|
return CrewAgentParser(agent=self.agent).parse(answer)
|
||||||
|
|
||||||
def _format_msg(self, prompt: str, role: str = "user") -> List[Dict[str, str]]:
|
def _format_msg(self, prompt: str, role: str = "user") -> Dict[str, str]:
|
||||||
return {"role": role, "content": prompt}
|
return {"role": role, "content": prompt}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class TokenManager:
|
|||||||
"""
|
"""
|
||||||
encrypted_data = self.read_secure_file(self.file_path)
|
encrypted_data = self.read_secure_file(self.file_path)
|
||||||
|
|
||||||
decrypted_data = self.fernet.decrypt(encrypted_data)
|
decrypted_data = self.fernet.decrypt(encrypted_data) # type: ignore
|
||||||
data = json.loads(decrypted_data)
|
data = json.loads(decrypted_data)
|
||||||
|
|
||||||
expiration = datetime.fromisoformat(data["expiration"])
|
expiration = datetime.fromisoformat(data["expiration"])
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class TaskOutput(BaseModel):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def json(self) -> Optional[str]:
|
def json(self) -> str:
|
||||||
if self.output_format != OutputFormat.JSON:
|
if self.output_format != OutputFormat.JSON:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user