improving types

This commit is contained in:
João Moura
2024-09-13 09:04:30 -03:00
parent 5f46a6de79
commit bd0e840486
4 changed files with 5 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ class Agent(BaseAgent):
allow_code_execution: Optional[bool] = Field(
default=False, description="Enable code execution for the agent."
)
respect_context_window: Optional[bool] = Field(
respect_context_window: bool = Field(
default=True,
description="Keep messages under the context window size by summarizing content.",
)

View File

@@ -24,7 +24,7 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
task: Any,
crew: Any,
agent: Any,
prompt: str,
prompt: dict[str, str],
max_iter: int,
tools: List[Any],
tools_names: str,
@@ -260,5 +260,5 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
def _format_answer(self, answer: str) -> str:
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}

View File

@@ -79,7 +79,7 @@ class TokenManager:
"""
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)
expiration = datetime.fromisoformat(data["expiration"])

View File

@@ -35,7 +35,7 @@ class TaskOutput(BaseModel):
return self
@property
def json(self) -> Optional[str]:
def json(self) -> str:
if self.output_format != OutputFormat.JSON:
raise ValueError(
"""