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


##########
tools/ut.sh:
##########
@@ -170,7 +170,7 @@ java_tests() {
 
         
exclude_list="!e2e-test/flink-agents-end-to-end-tests-integration,!e2e-test/flink-agents-end-to-end-tests-resource-cross-language"
 
-        mvn -T16 --batch-mode --no-transfer-progress test -pl "${exclude_list}"
+        mvn -T16 --batch-mode --no-transfer-progress test -fn -pl 
"${exclude_list}"

Review Comment:
   Should we use `-fae`?



##########
plan/src/main/java/org/apache/flink/agents/plan/AgentPlan.java:
##########
@@ -259,7 +259,7 @@ public Resource getResource(String name, ResourceType type) 
throws Exception {
 
         // Cache the resource
         resourceCache.computeIfAbsent(type, k -> new 
ConcurrentHashMap<>()).put(name, resource);
-
+        resource.open();

Review Comment:
   `open()` is called after putting the resource into the cache, which means if 
`open()` fails, the corrupted resource might be left in the cache.



##########
python/flink_agents/api/chat_models/chat_model.py:
##########
@@ -133,9 +137,11 @@ class BaseChatModelSetup(Resource):
     different chat configurations.
     """
 
-    connection: str = Field(description="Name of the referenced connection.")
+    connection: str | BaseChatModelConnection = Field(

Review Comment:
   We should always check that `connection` is a `BaseChatModelConnection` 
before using. Maybe overridding the getter? Same for other resources.r



##########
plan/src/main/java/org/apache/flink/agents/plan/actions/Utils.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+package org.apache.flink.agents.plan.actions;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+public final class Utils {
+    private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
+    private static final String defaultValue = "<unknown>";

Review Comment:
   DEFAULT_VALUE



##########
api/src/main/java/org/apache/flink/agents/api/chat/model/BaseChatModelSetup.java:
##########
@@ -35,18 +35,44 @@
 import java.util.function.BiFunction;
 
 public abstract class BaseChatModelSetup extends Resource {
-    protected final String connection;
+    protected final String connectionName;
     protected String model;
     protected Object prompt;
-    protected List<String> tools;
+    protected List<String> toolNames;
+
+    protected BaseChatModelConnection connection;

Review Comment:
   We should mark this `@Nullable`, and always check that it's not null before 
using it. Same for the other resources.



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