wenjin272 commented on code in PR #126:
URL: https://github.com/apache/flink-agents/pull/126#discussion_r2289958467


##########
python/flink_agents/api/agents/react_agent.py:
##########
@@ -0,0 +1,75 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+#################################################################################
+
+from flink_agents.api.agent import Agent
+from flink_agents.api.agents.constants import CHAT_HISTORY, DEFAULT_CHAT_MODEL
+from flink_agents.api.chat_message import ChatMessage, MessageRole
+from flink_agents.api.decorators import action
+from flink_agents.api.events.chat_event import ChatRequestEvent, 
ChatResponseEvent
+from flink_agents.api.events.event import InputEvent, OutputEvent
+from flink_agents.api.runner_context import RunnerContext
+
+
+class ReActAgent(Agent):
+    """Built-in implementation of ReAct agent which is based on the function
+    call ability of llm.
+
+    This implementation is not based on the foundational ReAct paper which uses
+    prompt to force llm output contain <Thought>, <Action> and <Observation> 
and
+    extract tool calls by text parsing. For a more robust and feature-rich
+    implementation we use the tool/function call ability of current llm, and 
get
+    the tool calls from response directly.
+
+    User can extend this class and overwrite the start_action and stop_action
+    to define their own logic to handle input and output.
+    """
+
+    @action(InputEvent)
+    @staticmethod
+    def start_action(event: InputEvent, ctx: RunnerContext) -> None:

Review Comment:
   Should we provide start_action and stop_action in ReActAgent?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to