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


##########
python/flink_agents/e2e_tests/chat_model_integration_test.py:
##########
@@ -82,3 +93,59 @@ def test_chat_model_integration(model_provider: str) -> 
None:  # noqa: D103
 
     assert "3" in output_list[0]["0001"]
     assert "cat" in output_list[1]["0002"]
+
[email protected](client is None, reason="Ollama client is not available or 
test model is missing.")
+def test_java_chat_model_integration(tmp_path: Path) -> None:  # noqa: D103
+    os.environ["MODEL_PROVIDER"] = "JAVA"

Review Comment:
   How is this variable set?



##########
api/src/main/java/org/apache/flink/agents/api/resource/ResourceDescriptor.java:
##########
@@ -20,36 +20,76 @@
 
 import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
 import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
-import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeInfo;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 /** Helper class to describe a {@link Resource} */
 public class ResourceDescriptor {
-    private static final String FIELD_CLAZZ = "clazz";
-    private static final String FIELD_INITIAL_ARGUMENTS = "initialArguments";
+    private static final String FIELD_CLAZZ = "java_clazz";
+    private static final String FIELD_PYTHON_CLAZZ = "python_clazz";
+    private static final String FIELD_PYTHON_MODULE = "python_module";
+    private static final String FIELD_INITIAL_ARGUMENTS = "arguments";
 
     @JsonProperty(FIELD_CLAZZ)
     private final String clazz;
 
-    // TODO: support nested map/list with non primitive value.
+    @JsonProperty(FIELD_PYTHON_CLAZZ)
+    private final String pythonClazz;
+
+    @JsonProperty(FIELD_PYTHON_MODULE)
+    private final String pythonModule;

Review Comment:
   Why do we need these?



##########
runtime/src/main/java/org/apache/flink/agents/runtime/python/utils/PythonActionExecutor.java:
##########
@@ -59,11 +59,22 @@ public class PythonActionExecutor {
 
     private final PythonInterpreter interpreter;
     private final String agentPlanJson;
+    private final JavaResourceAdapter javaResourceAdapter;
     private Object pythonAsyncThreadPool;
 
     public PythonActionExecutor(PythonInterpreter interpreter, String 
agentPlanJson) {
         this.interpreter = interpreter;
         this.agentPlanJson = agentPlanJson;
+        this.javaResourceAdapter = null;
+    }

Review Comment:
   Where is this constructor used?



##########
python/flink_agents/e2e_tests/chat_model_integration_test.py:
##########
@@ -82,3 +93,59 @@ def test_chat_model_integration(model_provider: str) -> 
None:  # noqa: D103
 
     assert "3" in output_list[0]["0001"]
     assert "cat" in output_list[1]["0002"]
+
[email protected](client is None, reason="Ollama client is not available or 
test model is missing.")

Review Comment:
   Should not mix cross-language tests with integration e2e tests.



##########
python/flink_agents/api/resource.py:
##########
@@ -73,23 +74,111 @@ def validate_serializable(self) -> "SerializableResource":
         return self
 
 
-class ResourceDescriptor:
-    """Descriptor of resource, includes the class and the initialize 
arguments."""
+class ResourceDescriptor(BaseModel):
+    """Descriptor for Resource instances, storing metadata for serialization 
and
+    instantiation.
 
-    _clazz: Type[Resource]
-    _arguments: Dict[str, Any]
-
-    def __init__(self, *, clazz: Type[Resource], **arguments: Any) -> None:
-        """Init method."""
-        self._clazz = clazz
-        self._arguments = arguments
-
-    @property
-    def clazz(self) -> Type[Resource]:
-        """Get the class of the resource."""
-        return self._clazz
-
-    @property
-    def arguments(self) -> Dict[str, Any]:
-        """Get the initialize arguments of the resource."""
-        return self._arguments
+    Attributes:
+        clazz: The Python Resource class name.
+        java_clazz: The Java class full path (e.g., 
'com.example.YourJavaClass').
+                   Empty string for Python-only resources.
+        arguments: Dictionary containing resource initialization parameters.
+    """
+    clazz: Type[Resource] | None = None
+    java_clazz: str

Review Comment:
   Why not just use the arguments?



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