Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
IMladjenovic committed Dec 13, 2024
1 parent 603f375 commit 876613c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/promptfoo/materiality_agent_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: "Test Dynamic Knowledge Graph Prompts"
description: "Test Materiality Agent Prompts"

providers:
- id: openai:gpt-4o
Expand Down
2 changes: 1 addition & 1 deletion backend/promptfoo/report_agent_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: "Test Report Prompt"
description: "Test Report Agent Prompts"

providers:
- id: mistral:mistral-large-latest
Expand Down
2 changes: 1 addition & 1 deletion backend/src/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def invoke(self, utterance: str) -> str:
T = TypeVar('T', bound=ChatAgent)


def chat_agent(name: str, description: str, tools: Optional[List[Tool]] = None):
def chat_agent(name: str, description: str, tools: List[Tool] = None):

Check failure on line 70 in backend/src/agents/agent.py

View workflow job for this annotation

GitHub Actions / Type Checking Backend

Expression of type "None" cannot be assigned to parameter of type "List[Tool]"   "None" is not assignable to "List[Tool]" (reportArgumentType)
def decorator(chat_agent: Type[T]) -> Type[T]:
chat_agent.name = name
chat_agent.description = description
Expand Down
3 changes: 3 additions & 0 deletions backend/src/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def handle_file_upload(file: UploadFile) -> FileUpload:
if (file.size or 0) > MAX_FILE_SIZE:
raise HTTPException(status_code=413, detail=f"File upload must be less than {MAX_FILE_SIZE} bytes")

if not file.filename:
raise HTTPException(status_code=400, detail=f"File upload must have a filename")

Check failure on line 21 in backend/src/utils/file_utils.py

View workflow job for this annotation

GitHub Actions / Linting Backend

Ruff (F541)

backend/src/utils/file_utils.py:21:53: F541 f-string without any placeholders

if "application/pdf" == file.content_type:
start_time = time.time()
pdf_file = PdfReader(file.file)
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/session/test_file_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,17 @@ def test_clear_session_file_uploads_meta(mocker, mock_redis, mock_request_contex

def test_store_report(mocker, mock_redis):
mocker.patch("src.session.file_uploads.redis_client", mock_redis)
report = FileUploadReport(filename="test.txt", id="12", report="test report")
report = FileUploadReport(filename="test.txt", id="12", report="test report", answer="chat message")

store_report(report)

mock_redis.set.assert_called_with("report_12", json.dumps(report))


def test_get_report(mocker, mock_redis):
mocker.patch("src.session.file_uploads.redis_client", mock_redis)

report = FileUploadReport(filename="test.txt", id="12", report="test report")
report = FileUploadReport(filename="test.txt", id="12", report="test report", answer="chat message")
mock_redis.get.return_value = json.dumps(report)

value = get_report("12")
Expand Down

0 comments on commit 876613c

Please sign in to comment.