Team Workflow aggiornato #37

Merged
Berack96 merged 16 commits from 19-team-instructions into main 2025-10-20 22:05:58 +02:00
6 changed files with 14 additions and 7 deletions
Showing only changes of commit 2fbdcca892 - Show all commits

View File

@@ -45,12 +45,14 @@ class PipelineInputs:
""" """
Sceglie il modello LLM da usare per il Team Leader. 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] self.team_leader_model = self.configs.models.all_models[index]
copilot-pull-request-reviewer[bot] commented 2025-10-20 18:05:28 +02:00 (Migrated from github.com)
Review

Variable assignment uses team_leader_model instead of leader_model as mentioned in the method's docstring. The docstring should be updated or the variable name should be consistent.

Variable assignment uses `team_leader_model` instead of `leader_model` as mentioned in the method's docstring. The docstring should be updated or the variable name should be consistent.
copilot-pull-request-reviewer[bot] commented 2025-10-20 21:51:58 +02:00 (Migrated from github.com)
Review

The choose_team_leader method assigns to self.team_leader_model but the initialization in __init__ uses a different assignment pattern via get_model_by_name(). This inconsistency means the model assignment won't have the same validation and could break if index is out of bounds. Use self.team_leader_model = self.configs.models.all_models[index] with proper validation or use the same pattern as __init__.

        model_list = self.configs.models.all_models
        if 0 <= index < len(model_list):
            model_name = model_list[index].name
            self.team_leader_model = self.configs.get_model_by_name(model_name)
        else:
            raise IndexError(f"Model index {index} out of range for team leader selection.")
The `choose_team_leader` method assigns to `self.team_leader_model` but the initialization in `__init__` uses a different assignment pattern via `get_model_by_name()`. This inconsistency means the model assignment won't have the same validation and could break if `index` is out of bounds. Use `self.team_leader_model = self.configs.models.all_models[index]` with proper validation or use the same pattern as `__init__`. ```suggestion model_list = self.configs.models.all_models if 0 <= index < len(model_list): model_name = model_list[index].name self.team_leader_model = self.configs.get_model_by_name(model_name) else: raise IndexError(f"Model index {index} out of range for team leader selection.") ```
def choose_team(self, index: int): def choose_team(self, index: int):
""" """
Sceglie il modello LLM da usare per il Team. 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] self.team_model = self.configs.models.all_models[index]
copilot-pull-request-reviewer[bot] commented 2025-10-20 21:51:59 +02:00 (Migrated from github.com)
Review

The choose_team method has the same issue as choose_team_leader: it directly indexes into all_models without validation, which could raise an IndexError if the index is invalid. Consider adding bounds checking or using a safer retrieval method.

        all_models = self.configs.models.all_models
        if not (0 <= index < len(all_models)):
            raise ValueError(f"Invalid index {index} for team models. Must be between 0 and {len(all_models)-1}.")
        self.team_model = all_models[index]
The `choose_team` method has the same issue as `choose_team_leader`: it directly indexes into `all_models` without validation, which could raise an `IndexError` if the index is invalid. Consider adding bounds checking or using a safer retrieval method. ```suggestion all_models = self.configs.models.all_models if not (0 <= index < len(all_models)): raise ValueError(f"Invalid index {index} for team models. Must be between 0 and {len(all_models)-1}.") self.team_model = all_models[index] ```
def choose_strategy(self, index: int): def choose_strategy(self, index: int):

View File

@@ -46,6 +46,11 @@ class Pipeline:
""" """
def __init__(self, inputs: PipelineInputs): def __init__(self, inputs: PipelineInputs):
copilot-pull-request-reviewer[bot] commented 2025-10-20 21:51:58 +02:00 (Migrated from github.com)
Review

The Pipeline class is missing a docstring. Add a class-level docstring explaining its purpose, key responsibilities, and basic usage pattern.

The `Pipeline` class is missing a docstring. Add a class-level docstring explaining its purpose, key responsibilities, and basic usage pattern.
"""
Inizializza la pipeline con gli input forniti.
Args:
inputs: istanza di PipelineInputs contenente le configurazioni e i parametri della pipeline.
"""
self.inputs = inputs self.inputs = inputs
def interact(self, listeners: list[tuple[PipelineEvent, Callable[[Any], None]]] = []) -> str: def interact(self, listeners: list[tuple[PipelineEvent, Callable[[Any], None]]] = []) -> str:

View File

@@ -12,7 +12,7 @@ class Task(TypedDict):
class PlanMemoryTool(Toolkit): class PlanMemoryTool(Toolkit):
def __init__(self): def __init__(self):
self.tasks: list[Task] = [] 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.", 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=[ tools=[
self.add_tasks, self.add_tasks,

View File

@@ -14,5 +14,5 @@ GOAL: check if the query is crypto-related
3) Ouput the result: 3) Ouput the result:
- if is crypto related then output the query - 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

View File

@@ -12,7 +12,7 @@ class TestQueryCheckAgent:
self.agent = self.model.get_agent(QUERY_CHECK_INSTRUCTIONS, output_schema=QueryOutputs) self.agent = self.model.get_agent(QUERY_CHECK_INSTRUCTIONS, output_schema=QueryOutputs)
def test_query_not_ok(self): 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 is not None
assert response.content is not None assert response.content is not None
content = response.content content = response.content
@@ -20,7 +20,7 @@ class TestQueryCheckAgent:
assert content.is_crypto == False assert content.is_crypto == False
def test_query_not_ok2(self): 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 is not None
assert response.content is not None assert response.content is not None
content = response.content content = response.content
@@ -28,7 +28,7 @@ class TestQueryCheckAgent:
assert content.is_crypto == False assert content.is_crypto == False
def test_query_ok(self): 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 is not None
assert response.content is not None assert response.content is not None
content = response.content content = response.content
@@ -36,7 +36,7 @@ class TestQueryCheckAgent:
assert content.is_crypto == True assert content.is_crypto == True
def test_query_ok2(self): 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 is not None
assert response.content is not None assert response.content is not None
content = response.content content = response.content

View File

@@ -19,7 +19,7 @@ class TestReportGenerationAgent:
No significant regulatory news has been reported and the social media sentiment remains unknown. 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 is not None
assert response.content is not None assert response.content is not None
content = response.content content = response.content