diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 18e7498..2b11178 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,4 +11,4 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 \ No newline at end of file + - uses: pre-commit/action@v3.0.1 diff --git a/agent_gateway/agents/agent.py b/agent_gateway/agents/agent.py index 2344ea7..4b89fb1 100644 --- a/agent_gateway/agents/agent.py +++ b/agent_gateway/agents/agent.py @@ -15,8 +15,9 @@ import json import logging from abc import abstractmethod +from collections.abc import Sequence from pathlib import Path -from typing import Any, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Dict, List, Optional, Tuple, Union import yaml from chains.llm_chain import LLMChain diff --git a/agent_gateway/chains/llm_chain.py b/agent_gateway/chains/llm_chain.py index c8a7e67..b657568 100644 --- a/agent_gateway/chains/llm_chain.py +++ b/agent_gateway/chains/llm_chain.py @@ -14,7 +14,8 @@ import logging import warnings -from typing import Any, Dict, List, Optional, Sequence, Tuple, Union +from collections.abc import Sequence +from typing import Any, Dict, List, Optional, Tuple, Union from langchain.callbacks.manager import ( AsyncCallbackManager, diff --git a/agent_gateway/gateway/gateway.py b/agent_gateway/gateway/gateway.py index 28c3e4b..d781beb 100644 --- a/agent_gateway/gateway/gateway.py +++ b/agent_gateway/gateway/gateway.py @@ -15,7 +15,8 @@ import logging import re import threading -from typing import Any, Dict, List, Mapping, Optional, Sequence, Union, cast +from collections.abc import Sequence +from typing import Any, Dict, List, Mapping, Optional, Union, cast from snowflake.connector.connection import SnowflakeConnection from snowflake.snowpark import Session diff --git a/agent_gateway/gateway/output_parser.py b/agent_gateway/gateway/output_parser.py index 77dcad2..ec2170f 100644 --- a/agent_gateway/gateway/output_parser.py +++ b/agent_gateway/gateway/output_parser.py @@ -12,7 +12,8 @@ import ast import re -from typing import Any, Sequence, Tuple, Union +from collections.abc import Sequence +from typing import Any, Tuple, Union from langchain.schema import OutputParserException diff --git a/agent_gateway/gateway/planner.py b/agent_gateway/gateway/planner.py index 12621b6..128973b 100644 --- a/agent_gateway/gateway/planner.py +++ b/agent_gateway/gateway/planner.py @@ -16,11 +16,13 @@ import json import logging import re -from typing import Any, Optional, Sequence, Union +from collections.abc import Sequence +from typing import Any, Optional, Union from uuid import UUID from langchain.callbacks.base import AsyncCallbackHandler +from agent_gateway.executors.schema import Plan from agent_gateway.gateway.constants import END_OF_PLAN from agent_gateway.gateway.output_parser import ( ACTION_PATTERN, @@ -29,7 +31,6 @@ instantiate_task, ) from agent_gateway.gateway.task_processor import Task -from agent_gateway.executors.schema import Plan from agent_gateway.tools.base import StructuredTool, Tool from agent_gateway.tools.logger import gateway_logger from agent_gateway.tools.utils import CortexEndpointBuilder, post_cortex_request diff --git a/agent_gateway/gateway/task_processor.py b/agent_gateway/gateway/task_processor.py index 442badf..79dd677 100644 --- a/agent_gateway/gateway/task_processor.py +++ b/agent_gateway/gateway/task_processor.py @@ -14,8 +14,9 @@ import asyncio import logging +from collections.abc import Collection from dataclasses import dataclass -from typing import Any, Callable, Collection, Dict, List, Optional +from typing import Any, Callable, Dict, List, Optional from agent_gateway.tools.logger import gateway_logger diff --git a/agent_gateway/tools/base.py b/agent_gateway/tools/base.py index 272b2bb..6cb3cbe 100644 --- a/agent_gateway/tools/base.py +++ b/agent_gateway/tools/base.py @@ -197,9 +197,7 @@ def __init__( self, name: str, func: Optional[Callable], description: str, **kwargs: Any ) -> None: """Initialize tool.""" - super(Tool, self).__init__( - name=name, func=func, description=description, **kwargs - ) + super().__init__(name=name, func=func, description=description, **kwargs) @classmethod def from_function( diff --git a/agent_gateway/tools/logger.py b/agent_gateway/tools/logger.py index 871ffcc..ff4b3e3 100644 --- a/agent_gateway/tools/logger.py +++ b/agent_gateway/tools/logger.py @@ -37,7 +37,7 @@ class Logger: def __new__(cls): if cls._instance is None: - cls._instance = super(Logger, cls).__new__(cls) + cls._instance = super().__new__(cls) cls._instance.init() return cls._instance diff --git a/agent_gateway/tools/snowflake_tools.py b/agent_gateway/tools/snowflake_tools.py index 6f64f9c..a637c36 100644 --- a/agent_gateway/tools/snowflake_tools.py +++ b/agent_gateway/tools/snowflake_tools.py @@ -326,9 +326,7 @@ def __init__( self.FILE = semantic_model self.STAGE = stage - gateway_logger.log( - logging.INFO, "Cortex Analyst Tool successfully initialized" - ) + gateway_logger.log(logging.INFO, "Cortex Analyst Tool successfully initialized") def __call__(self, prompt) -> Any: return self.asearch(query=prompt)