xintongsong commented on code in PR #121:
URL: https://github.com/apache/flink-agents/pull/121#discussion_r2300324039


##########
python/flink_agents/examples/chat_tongyi_example.py:
##########
@@ -0,0 +1,144 @@
+################################################################################
+#  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.
+#################################################################################
+import os
+from typing import Any, Dict, Tuple, Type
+
+from flink_agents.api.agent import Agent
+from flink_agents.api.chat_message import ChatMessage, MessageRole
+from flink_agents.api.chat_models.chat_model import (
+    BaseChatModelConnection,
+    BaseChatModelSetup,
+)
+from flink_agents.api.decorators import action, chat_model, chat_model_server, 
tool
+from flink_agents.api.events.chat_event import ChatRequestEvent, 
ChatResponseEvent
+from flink_agents.api.events.event import (
+    InputEvent,
+    OutputEvent,
+)
+from flink_agents.api.execution_environment import AgentsExecutionEnvironment
+from flink_agents.api.runner_context import RunnerContext
+from flink_agents.integrations.chat_models.tongyi_chat_model import (
+    TongyiChatModelConnection,
+    TongyiChatModelSetup,
+)
+
+model = os.environ.get("TONGYI_CHAT_MODEL", "qwen-plus")
+
+
+class MyTongyiAgent(Agent):

Review Comment:
   We probably should not introduce a new example for each model that we 
support. Why not reuse one agent with parameterized chat model?



##########
python/flink_agents/api/chat_models/chat_model.py:
##########
@@ -48,6 +49,34 @@ def resource_type(cls) -> ResourceType:
         """Return resource type of class."""
         return ResourceType.CHAT_MODEL_CONNECTION
 
+    _THINK_RE: ClassVar[re.Pattern[str]] = re.compile(r"<think>(.*?)</think>", 
re.DOTALL)

Review Comment:
   Is this a common pattern for all models?



-- 
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