fix typing hint

This commit is contained in:
2025-10-31 14:23:18 +01:00
parent a38d928f1b
commit 0a0033c47b
3 changed files with 10 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
from typing import Any, Callable
# Registro centrale popolato da tutti i file Toolkit all'avvio. # Registro centrale popolato da tutti i file Toolkit all'avvio.
ACTION_DESCRIPTIONS: dict[str, str] = {} ACTION_DESCRIPTIONS: dict[str, str] = {}
@@ -9,7 +12,7 @@ def get_user_friendly_action(tool_name: str) -> str:
# Usa il dizionario ACTION_DESCRIPTIONS importato # Usa il dizionario ACTION_DESCRIPTIONS importato
return ACTION_DESCRIPTIONS.get(tool_name, f"⚙️ Eseguo l'operazione: {tool_name}...") 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" Decoratore che registra automaticamente la descrizione "user-friendly"
di un metodo nel registro globale. di un metodo nel registro globale.
@@ -20,7 +23,7 @@ def friendly_action(description: str):
Restituisce la funzione originale non modificata. Restituisce la funzione originale non modificata.
""" """
def decorator(func): def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
# Registra l'azione # Registra l'azione
tool_name = func.__name__ tool_name = func.__name__
if tool_name in ACTION_DESCRIPTIONS: if tool_name in ACTION_DESCRIPTIONS:

View File

@@ -111,7 +111,6 @@ class PipelineInputs:
name="CryptoAnalysisTeam", name="CryptoAnalysisTeam",
tools=[ReasoningTools(), PlanMemoryTool(), CryptoSymbolsTools()], tools=[ReasoningTools(), PlanMemoryTool(), CryptoSymbolsTools()],
members=[market_agent, news_agent, social_agent], members=[market_agent, news_agent, social_agent],
stream_intermediate_steps=True
) )
def get_agent_query_checker(self) -> Agent: def get_agent_query_checker(self) -> Agent:
@@ -152,11 +151,11 @@ class RunMessage:
prefix (str, optional): Prefisso del messaggio. Defaults to "" prefix (str, optional): Prefisso del messaggio. Defaults to ""
suffix (str, optional): Suffisso 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.base_message = f"Running configurations: \n{prefix}{inputs}{suffix}\n\n"
self.emojis = ['🔳', '➡️', ''] self.emojis = ['🔳', '➡️', '']
self.placeholder = '<<<>>>' self.placeholder = '<<<>>>'
self.current = 0
self.steps_total: list[tuple[str, int]] = []
self.set_steps(["Query Check", "Info Recovery", "Report Generation"]) self.set_steps(["Query Check", "Info Recovery", "Report Generation"])
def set_steps(self, steps: list[str]) -> 'RunMessage': def set_steps(self, steps: list[str]) -> 'RunMessage':

View File

@@ -106,7 +106,8 @@ class Pipeline:
# Step 2: Crea gli steps # Step 2: Crea gli steps
def condition_query_ok(step_input: StepInput) -> StepOutput: def condition_query_ok(step_input: StepInput) -> StepOutput:
val = step_input.previous_step_content 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) query_check = Step(name=PipelineEvent.QUERY_CHECK, agent=query_check)
info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team) info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team)