Skip to content

Commit

Permalink
Merge pull request #182 from ksachdeva/fix-Any-typos
Browse files Browse the repository at this point in the history
fix[typos] - use `Any` from typing instead of `any` (which is a function)
  • Loading branch information
brnaba-aws authored Dec 27, 2024
2 parents c170526 + 4ade61b commit 492df51
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions python/src/multi_agent_orchestrator/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AgentProcessingResult:
agent_name: str
user_id: str
session_id: str
additional_params: Dict[str, any] = field(default_factory=dict)
additional_params: Dict[str, Any] = field(default_factory=dict)


@dataclass
Expand Down Expand Up @@ -76,7 +76,7 @@ async def process_request(
session_id: str,
chat_history: List[ConversationMessage],
additional_params: Optional[Dict[str, str]] = None,
) -> Union[ConversationMessage, AsyncIterable[any]]:
) -> Union[ConversationMessage, AsyncIterable[Any]]:
pass

def log_debug(self, class_name, message, data=None):
Expand Down
10 changes: 5 additions & 5 deletions python/src/multi_agent_orchestrator/agents/chain_agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Dict, Union, AsyncIterable, Optional
from typing import List, Dict, Union, AsyncIterable, Optional, Any
from multi_agent_orchestrator.types import ConversationMessage, ParticipantRole
from multi_agent_orchestrator.utils.logger import Logger
from .agent import Agent, AgentOptions
Expand All @@ -24,9 +24,9 @@ async def process_request(
session_id: str,
chat_history: List[ConversationMessage],
additional_params: Optional[Dict[str, str]] = None
) -> Union[ConversationMessage, AsyncIterable[any]]:
) -> Union[ConversationMessage, AsyncIterable[Any]]:
current_input = input_text
final_response: Union[ConversationMessage, AsyncIterable[any]]
final_response: Union[ConversationMessage, AsyncIterable[Any]]

for i, agent in enumerate(self.agents):
is_last_agent = i == len(self.agents) - 1
Expand Down Expand Up @@ -67,11 +67,11 @@ async def process_request(
return final_response

@staticmethod
def is_async_iterable(obj: any) -> bool:
def is_async_iterable(obj: Any) -> bool:
return hasattr(obj, '__aiter__')

@staticmethod
def is_conversation_message(response: any) -> bool:
def is_conversation_message(response: Any) -> bool:
return (
isinstance(response, ConversationMessage) and
hasattr(response, 'role') and
Expand Down
13 changes: 7 additions & 6 deletions python/src/multi_agent_orchestrator/retrievers/retriever.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Any
from abc import ABC, abstractmethod

class Retriever(ABC):
Expand All @@ -16,7 +17,7 @@ def __init__(self, options: dict):
self._options = options

@abstractmethod
async def retrieve(self, text: str) -> any:
async def retrieve(self, text: str) -> Any:
"""
Abstract method for retrieving information based on input text.
This method must be implemented by all concrete subclasses.
Expand All @@ -25,12 +26,12 @@ async def retrieve(self, text: str) -> any:
text (str): The input text to base the retrieval on.
Returns:
any: The retrieved information.
Any: The retrieved information.
"""
pass

@abstractmethod
async def retrieve_and_combine_results(self, text: str) -> any:
async def retrieve_and_combine_results(self, text: str) -> Any:
"""
Abstract method for retrieving information and combining results.
This method must be implemented by all concrete subclasses.
Expand All @@ -40,12 +41,12 @@ async def retrieve_and_combine_results(self, text: str) -> any:
text (str): The input text to base the retrieval on.
Returns:
any: The combined retrieval results.
Any: The combined retrieval results.
"""
pass

@abstractmethod
async def retrieve_and_generate(self, text: str) -> any:
async def retrieve_and_generate(self, text: str) -> Any:
"""
Abstract method for retrieving information and generating something based on the results.
This method must be implemented by all concrete subclasses.
Expand All @@ -55,6 +56,6 @@ async def retrieve_and_generate(self, text: str) -> any:
text (str): The input text to base the retrieval on.
Returns:
any: The generated information based on retrieval results.
Any: The generated information based on retrieval results.
"""
pass

0 comments on commit 492df51

Please sign in to comment.