From 2fbdcca8926d1b5c300c64541db3ca8b12778398 Mon Sep 17 00:00:00 2001 From: Berack96 Date: Mon, 20 Oct 2025 21:58:52 +0200 Subject: [PATCH] copilot fixes --- src/app/agents/core.py | 2 ++ src/app/agents/pipeline.py | 5 +++++ src/app/agents/plan_memory_tool.py | 2 +- src/app/agents/prompts/query_check.txt | 2 +- tests/agents/test_query_check.py | 8 ++++---- tests/agents/test_report.py | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/agents/core.py b/src/app/agents/core.py index 78ca1db..c3fd089 100644 --- a/src/app/agents/core.py +++ b/src/app/agents/core.py @@ -45,12 +45,14 @@ class PipelineInputs: """ Sceglie il modello LLM da usare per il Team Leader. """ + assert index >= 0 and index < len(self.configs.models.all_models), "Index out of range for models list." self.team_leader_model = self.configs.models.all_models[index] def choose_team(self, index: int): """ Sceglie il modello LLM da usare per il Team. """ + assert index >= 0 and index < len(self.configs.models.all_models), "Index out of range for models list." self.team_model = self.configs.models.all_models[index] def choose_strategy(self, index: int): diff --git a/src/app/agents/pipeline.py b/src/app/agents/pipeline.py index 4efdd2c..bcec72d 100644 --- a/src/app/agents/pipeline.py +++ b/src/app/agents/pipeline.py @@ -46,6 +46,11 @@ class Pipeline: """ def __init__(self, inputs: PipelineInputs): + """ + Inizializza la pipeline con gli input forniti. + Args: + inputs: istanza di PipelineInputs contenente le configurazioni e i parametri della pipeline. + """ self.inputs = inputs def interact(self, listeners: list[tuple[PipelineEvent, Callable[[Any], None]]] = []) -> str: diff --git a/src/app/agents/plan_memory_tool.py b/src/app/agents/plan_memory_tool.py index c78ebe9..f92accd 100644 --- a/src/app/agents/plan_memory_tool.py +++ b/src/app/agents/plan_memory_tool.py @@ -12,7 +12,7 @@ class Task(TypedDict): class PlanMemoryTool(Toolkit): def __init__(self): self.tasks: list[Task] = [] - Toolkit.__init__(self, # type: ignore + Toolkit.__init__(self, # type: ignore[call-arg] instructions="This tool manages an execution plan. Add tasks, get the next pending task, update a task's status (completed, failed) and result, or list all tasks.", tools=[ self.add_tasks, diff --git a/src/app/agents/prompts/query_check.txt b/src/app/agents/prompts/query_check.txt index 903cb54..ef6aa79 100644 --- a/src/app/agents/prompts/query_check.txt +++ b/src/app/agents/prompts/query_check.txt @@ -14,5 +14,5 @@ GOAL: check if the query is crypto-related 3) Ouput the result: - if is crypto related then output the query - - if is not crypto related, then output why is not releated in a brief message + - if is not crypto related, then output why is not related in a brief message diff --git a/tests/agents/test_query_check.py b/tests/agents/test_query_check.py index 693f9da..3043752 100644 --- a/tests/agents/test_query_check.py +++ b/tests/agents/test_query_check.py @@ -12,7 +12,7 @@ class TestQueryCheckAgent: self.agent = self.model.get_agent(QUERY_CHECK_INSTRUCTIONS, output_schema=QueryOutputs) def test_query_not_ok(self): - response = self.agent.run("Is the sky blue?") #type: ignore + response = self.agent.run("Is the sky blue?") # type: ignore assert response is not None assert response.content is not None content = response.content @@ -20,7 +20,7 @@ class TestQueryCheckAgent: assert content.is_crypto == False def test_query_not_ok2(self): - response = self.agent.run("What is the capital of France?") #type: ignore + response = self.agent.run("What is the capital of France?") # type: ignore assert response is not None assert response.content is not None content = response.content @@ -28,7 +28,7 @@ class TestQueryCheckAgent: assert content.is_crypto == False def test_query_ok(self): - response = self.agent.run("Bitcoin") #type: ignore + response = self.agent.run("Bitcoin") # type: ignore assert response is not None assert response.content is not None content = response.content @@ -36,7 +36,7 @@ class TestQueryCheckAgent: assert content.is_crypto == True def test_query_ok2(self): - response = self.agent.run("Ha senso investire in Ethereum?") #type: ignore + response = self.agent.run("Ha senso investire in Ethereum?") # type: ignore assert response is not None assert response.content is not None content = response.content diff --git a/tests/agents/test_report.py b/tests/agents/test_report.py index 7ae3536..265ad13 100644 --- a/tests/agents/test_report.py +++ b/tests/agents/test_report.py @@ -19,7 +19,7 @@ class TestReportGenerationAgent: No significant regulatory news has been reported and the social media sentiment remains unknown. """ - response = self.agent.run(sample_data) #type: ignore + response = self.agent.run(sample_data) # type: ignore assert response is not None assert response.content is not None content = response.content