From 56ddd967c0612f34eb46279383dd6c16f8ab3faa Mon Sep 17 00:00:00 2001 From: Ariel Frischer Date: Fri, 14 Feb 2025 13:54:36 -0800 Subject: [PATCH] fix(imports): remove redundant import of models_params in __main__.py for cleaner code style(fallback_handler.py): format error message for better readability style(test_llm.py): format exception assertion for better readability --- ra_aid/__main__.py | 3 +-- ra_aid/fallback_handler.py | 4 +++- tests/ra_aid/test_llm.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 46bd819..cf787fe 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -8,7 +8,6 @@ from langgraph.checkpoint.memory import MemorySaver from rich.console import Console from rich.panel import Panel from rich.text import Text -from ra_aid.models_params import models_params from ra_aid import print_error, print_stage_header from ra_aid.__version__ import __version__ @@ -29,7 +28,7 @@ from ra_aid.dependencies import check_dependencies from ra_aid.env import validate_environment from ra_aid.llm import initialize_llm from ra_aid.logging_config import get_logger, setup_logging -from ra_aid.models_params import DEFAULT_TEMPERATURE +from ra_aid.models_params import DEFAULT_TEMPERATURE, models_params from ra_aid.project_info import format_project_info, get_project_info from ra_aid.prompts import CHAT_PROMPT, WEB_RESEARCH_PROMPT_SECTION_CHAT from ra_aid.tool_configs import get_chat_tools diff --git a/ra_aid/fallback_handler.py b/ra_aid/fallback_handler.py index 1958a00..3f7750c 100644 --- a/ra_aid/fallback_handler.py +++ b/ra_aid/fallback_handler.py @@ -349,7 +349,9 @@ class FallbackHandler: ): return self.current_tool_to_bind.invoke(arguments) else: - raise FallbackToolExecutionError(f"Tool '{name}' not found in available tools.") + raise FallbackToolExecutionError( + f"Tool '{name}' not found in available tools." + ) def base_message_to_tool_call_dict(self, response: BaseMessage): """ diff --git a/tests/ra_aid/test_llm.py b/tests/ra_aid/test_llm.py index 853be14..2193d8b 100644 --- a/tests/ra_aid/test_llm.py +++ b/tests/ra_aid/test_llm.py @@ -237,7 +237,9 @@ def test_initialize_openai_compatible(clean_env, mock_openai): def test_initialize_unsupported_provider(clean_env): """Test initialization with unsupported provider raises ValueError""" - with pytest.raises(ValueError, match=r"Missing required environment variable for provider: unknown"): + with pytest.raises( + ValueError, match=r"Missing required environment variable for provider: unknown" + ): initialize_llm("unknown", "model")