Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaphoenix committed Nov 14, 2024
1 parent f4b55a6 commit 949e3f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/dfcx_scrapi/tools/agent_task_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def trim_playbook_data(self, playbooks: Any):

def get_agent_tasks(self) -> Dict[str, Any]:
"""Extract App/Agent details and determine Agent's task list."""
task_msg = f"*** AUTO-GENERATING AGENT TASK LIST ***"
task_msg = "*** AUTO-GENERATING AGENT TASK LIST ***"
logging.info(task_msg)

agent = self.agents.get_agent(self.agent_id)
Expand Down Expand Up @@ -335,7 +335,7 @@ def get_agent_tasks(self) -> Dict[str, Any]:
def get_agent_tasks_from_user_input(
self, tasks: Any) -> Dict[str, Any]:
"""Given an arbitrary user input, clean and format with LLM."""
task_msg = f"*** FORMATTING AGENT TASK LIST ***"
task_msg = "*** FORMATTING AGENT TASK LIST ***"
logging.info(task_msg)

prompt = Prompts.user_task_main.replace("{USER_DETAILS}", str(tasks))
Expand Down
5 changes: 3 additions & 2 deletions src/dfcx_scrapi/tools/gcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import json
from google.cloud import storage
from google.api_core.exceptions import NotFound

class GcsUtils:
def __init__(self, gcs_path: str = None):
Expand Down Expand Up @@ -114,5 +115,5 @@ def bucket_exists(self, bucket_name: str):
try:
storage_client = storage.Client()
storage_client.get_bucket(bucket_name)
except:
raise ValueError(f"GCS Bucket `{bucket_name}` does not exist.")
except NotFound:
raise NotFound(f"GCS Bucket `{bucket_name}` does not exist.")
6 changes: 3 additions & 3 deletions tests/dfcx_scrapi/tools/test_agent_task_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

import json
import pytest
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock

from google.oauth2.service_account import Credentials

from google.cloud.dialogflowcx_v3beta1 import types
from vertexai.generative_models import GenerativeModel, GenerationResponse
from dfcx_scrapi.tools.gcs_utils import GcsUtils
from dfcx_scrapi.tools.agent_task_generator import AgentTaskGenerator, Prompts
from dfcx_scrapi.tools.agent_task_generator import AgentTaskGenerator


@pytest.fixture
Expand Down Expand Up @@ -410,7 +410,7 @@ def test_get_agent_tasks_from_user_input(test_config):

assert isinstance(tasks, dict)
assert isinstance(atg.model, GenerativeModel)
assert atg.creds == None
assert atg.creds is None
atg.model.generate_content.assert_called_once()
assert tasks == test_config["expected_tasks"]

Expand Down

0 comments on commit 949e3f6

Please sign in to comment.