This is an automated email from the ASF dual-hosted git repository. xtsong pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 7ca8cb284dff0018c6ab9609941fdbe9bf3c6926 Author: WenjinXie <wenjin...@gmail.com> AuthorDate: Tue Aug 5 17:31:10 2025 +0800 [hotfix] Remove useless parameter chat_history from ChatModel#chat. --- python/flink_agents/api/chat_models/chat_model.py | 8 +------- python/flink_agents/plan/tests/test_agent_plan.py | 8 ++------ python/flink_agents/runtime/tests/test_built_in_actions.py | 8 ++------ python/flink_agents/runtime/tests/test_get_resource_in_action.py | 8 ++------ 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/python/flink_agents/api/chat_models/chat_model.py b/python/flink_agents/api/chat_models/chat_model.py index f7cecbd..8a24681 100644 --- a/python/flink_agents/api/chat_models/chat_model.py +++ b/python/flink_agents/api/chat_models/chat_model.py @@ -47,19 +47,13 @@ class BaseChatModel(Resource, ABC): return ResourceType.CHAT_MODEL @abstractmethod - def chat( - self, - messages: Sequence[ChatMessage], - chat_history: Optional[List[ChatMessage]] = None, - ) -> ChatMessage: + def chat(self, messages: Sequence[ChatMessage]) -> ChatMessage: """Process a sequence of messages, and return a response. Parameters ---------- messages : Sequence[ChatMessage] Sequence of chat messages. - chat_history : Optional[List[ChatMessage]] - History of chat conversation. Returns: ------- diff --git a/python/flink_agents/plan/tests/test_agent_plan.py b/python/flink_agents/plan/tests/test_agent_plan.py index 6c2dca6..bde70e8 100644 --- a/python/flink_agents/plan/tests/test_agent_plan.py +++ b/python/flink_agents/plan/tests/test_agent_plan.py @@ -17,7 +17,7 @@ ################################################################################# import json from pathlib import Path -from typing import Any, Dict, List, Optional, Sequence, Tuple, Type +from typing import Any, Dict, Sequence, Tuple, Type import pytest @@ -81,11 +81,7 @@ class MockChatModelImpl(BaseChatModel): # noqa: D101 def resource_type(cls) -> ResourceType: # noqa: D102 return ResourceType.CHAT_MODEL - def chat( - self, - messages: Sequence[ChatMessage], - chat_history: Optional[List[ChatMessage]] = None, - ) -> ChatMessage: + def chat(self, messages: Sequence[ChatMessage]) -> ChatMessage: """Testing Implementation.""" return ChatMessage( role=MessageRole.ASSISTANT, content=self.host + " " + self.desc diff --git a/python/flink_agents/runtime/tests/test_built_in_actions.py b/python/flink_agents/runtime/tests/test_built_in_actions.py index f86dfff..c0f9a47 100644 --- a/python/flink_agents/runtime/tests/test_built_in_actions.py +++ b/python/flink_agents/runtime/tests/test_built_in_actions.py @@ -16,7 +16,7 @@ # limitations under the License. ################################################################################# import uuid -from typing import Any, Dict, List, Optional, Sequence, Tuple, Type +from typing import Any, Dict, List, Sequence, Tuple, Type from flink_agents.api.agent import Agent from flink_agents.api.chat_message import ChatMessage, MessageRole @@ -53,11 +53,7 @@ class MockChatModel(BaseChatModel): if self.prompt is not None and isinstance(self.prompt, str): self.prompt = self.get_resource(self.prompt, ResourceType.PROMPT) - def chat( - self, - messages: Sequence[ChatMessage], - chat_history: Optional[List[ChatMessage]] = None, - ) -> ChatMessage: + def chat(self, messages: Sequence[ChatMessage]) -> ChatMessage: """Generate tool call or response according to input.""" # generate tool call if "sum" in messages[-1].content: diff --git a/python/flink_agents/runtime/tests/test_get_resource_in_action.py b/python/flink_agents/runtime/tests/test_get_resource_in_action.py index 3dbbf4a..ec861ca 100644 --- a/python/flink_agents/runtime/tests/test_get_resource_in_action.py +++ b/python/flink_agents/runtime/tests/test_get_resource_in_action.py @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ################################################################################# -from typing import Any, Dict, List, Optional, Sequence, Tuple, Type +from typing import Any, Dict, Sequence, Tuple, Type from flink_agents.api.agent import Agent from flink_agents.api.chat_message import ChatMessage, MessageRole @@ -31,11 +31,7 @@ class MockChatModelImpl(BaseChatModel): # noqa: D101 host: str desc: str - def chat( # noqa: D102 - self, - messages: Sequence[ChatMessage], - chat_history: Optional[List[ChatMessage]] = None, - ) -> ChatMessage: + def chat(self, messages: Sequence[ChatMessage]) -> ChatMessage: # noqa: D102 return ChatMessage( role=MessageRole.ASSISTANT, content=f"{messages[0].content} {self.host} {self.desc}",