From 0a0033c47b626db4fc47e9bd6e1ed48dd7acffa5 Mon Sep 17 00:00:00 2001 From: Berack96 Date: Fri, 31 Oct 2025 14:23:18 +0100 Subject: [PATCH] fix typing hint --- src/app/agents/action_registry.py | 9 ++++++--- src/app/agents/core.py | 5 ++--- src/app/agents/pipeline.py | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/agents/action_registry.py b/src/app/agents/action_registry.py index 683989e..2d04d09 100644 --- a/src/app/agents/action_registry.py +++ b/src/app/agents/action_registry.py @@ -1,3 +1,6 @@ +from typing import Any, Callable + + # Registro centrale popolato da tutti i file Toolkit all'avvio. ACTION_DESCRIPTIONS: dict[str, str] = {} @@ -9,7 +12,7 @@ def get_user_friendly_action(tool_name: str) -> str: # Usa il dizionario ACTION_DESCRIPTIONS importato return ACTION_DESCRIPTIONS.get(tool_name, f"⚙️ Eseguo l'operazione: {tool_name}...") -def friendly_action(description: str): +def friendly_action(description: str) -> Callable[..., Any]: """ Decoratore che registra automaticamente la descrizione "user-friendly" di un metodo nel registro globale. @@ -20,7 +23,7 @@ def friendly_action(description: str): Restituisce la funzione originale non modificata. """ - def decorator(func): + def decorator(func: Callable[..., Any]) -> Callable[..., Any]: # Registra l'azione tool_name = func.__name__ if tool_name in ACTION_DESCRIPTIONS: @@ -31,4 +34,4 @@ def friendly_action(description: str): # Restituisce la funzione originale return func - return decorator \ No newline at end of file + return decorator diff --git a/src/app/agents/core.py b/src/app/agents/core.py index 29c0572..28deb7d 100644 --- a/src/app/agents/core.py +++ b/src/app/agents/core.py @@ -111,7 +111,6 @@ class PipelineInputs: name="CryptoAnalysisTeam", tools=[ReasoningTools(), PlanMemoryTool(), CryptoSymbolsTools()], members=[market_agent, news_agent, social_agent], - stream_intermediate_steps=True ) def get_agent_query_checker(self) -> Agent: @@ -152,11 +151,11 @@ class RunMessage: prefix (str, optional): Prefisso del messaggio. Defaults to "" suffix (str, optional): Suffisso del messaggio. Defaults to "" """ - self.current = None - self.steps_total = None self.base_message = f"Running configurations: \n{prefix}{inputs}{suffix}\n\n" self.emojis = ['🔳', '➡️', '✅'] self.placeholder = '<<<>>>' + self.current = 0 + self.steps_total: list[tuple[str, int]] = [] self.set_steps(["Query Check", "Info Recovery", "Report Generation"]) def set_steps(self, steps: list[str]) -> 'RunMessage': diff --git a/src/app/agents/pipeline.py b/src/app/agents/pipeline.py index b684aa6..d69d7f1 100644 --- a/src/app/agents/pipeline.py +++ b/src/app/agents/pipeline.py @@ -106,7 +106,8 @@ class Pipeline: # Step 2: Crea gli steps def condition_query_ok(step_input: StepInput) -> StepOutput: val = step_input.previous_step_content - return StepOutput(stop=not val.is_crypto) if isinstance(val, QueryOutputs) else StepOutput(stop=True) + stop = (not val.is_crypto) if isinstance(val, QueryOutputs) else True + return StepOutput(stop=stop) query_check = Step(name=PipelineEvent.QUERY_CHECK, agent=query_check) info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team)