From 1d183c9afe086ccb706eabba2b588ab48e191b79 Mon Sep 17 00:00:00 2001 From: "Ivan Mladjenovic (He/Him)" Date: Fri, 13 Dec 2024 11:13:57 +0000 Subject: [PATCH] further type check fixes --- backend/src/agents/__init__.py | 2 +- backend/src/agents/agent.py | 2 +- backend/src/agents/report_agent.py | 4 ++++ backend/tests/agents/materiality_agent_test.py | 2 +- backend/tests/directors/report_director_test.py | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/agents/__init__.py b/backend/src/agents/__init__.py index 1f483fb2..570a4b1e 100644 --- a/backend/src/agents/__init__.py +++ b/backend/src/agents/__init__.py @@ -1,4 +1,4 @@ -from typing import List, cast +from typing import List from src.utils import Config from src.agents.agent import Agent, ChatAgent, agent diff --git a/backend/src/agents/agent.py b/backend/src/agents/agent.py index 7389a0c0..74075d88 100644 --- a/backend/src/agents/agent.py +++ b/backend/src/agents/agent.py @@ -1,7 +1,7 @@ from abc import ABC import json import logging -from typing import List, Type, Union, TypeVar, Optional +from typing import List, Type, TypeVar, Optional from src.llm import LLM, get_llm from src.utils.log_publisher import LogPrefix, publish_log_info diff --git a/backend/src/agents/report_agent.py b/backend/src/agents/report_agent.py index 3a5f550d..51e14969 100644 --- a/backend/src/agents/report_agent.py +++ b/backend/src/agents/report_agent.py @@ -9,6 +9,10 @@ engine = PromptEngine() +@agent( + name="ReportAgent", + description="This agent is responsible for creating ESG reports on narrative documents" +) class ReportAgent(Agent): async def create_report(self, file_content: str, materiality_topics: dict[str, str]) -> str: user_prompt = engine.load_prompt( diff --git a/backend/tests/agents/materiality_agent_test.py b/backend/tests/agents/materiality_agent_test.py index 23254220..3c5bbe1b 100644 --- a/backend/tests/agents/materiality_agent_test.py +++ b/backend/tests/agents/materiality_agent_test.py @@ -24,7 +24,7 @@ async def test_invoke_calls_llm(mocker): agent = MaterialityAgent(llm_name="mockllm", model=mock_model) - with patch("builtins.open", mock_open(read_data=json.dumps(mock_catalogue))) as mock_file: + with patch("builtins.open", mock_open(read_data=json.dumps(mock_catalogue))): mock_llm.chat = mocker.AsyncMock(return_value=json.dumps(mock_selected_files)) mock_llm.chat_with_file = mocker.AsyncMock(return_value=json.dumps(mock_materiality_topics)) diff --git a/backend/tests/directors/report_director_test.py b/backend/tests/directors/report_director_test.py index 95768cdc..7539f8b0 100644 --- a/backend/tests/directors/report_director_test.py +++ b/backend/tests/directors/report_director_test.py @@ -3,7 +3,7 @@ from fastapi.datastructures import Headers import pytest -from src.session.file_uploads import FileUpload, FileUploadReport +from src.session.file_uploads import FileUpload from src.directors.report_director import report_on_file_upload