diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d9eefbd..5a12612 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: "17" + java-version: "21" distribution: "temurin" cache: maven - name: Build with Maven diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index bb777ed..090fa99 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/java/src/main/java/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionConfig.java b/java/src/main/java/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionConfig.java index f2e7eb2..00b4b70 100644 --- a/java/src/main/java/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionConfig.java +++ b/java/src/main/java/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionConfig.java @@ -2,7 +2,7 @@ public class JavaCodeExecutionConfig { - private String executable = "java"; + private String executable; private String workingDirectory; diff --git a/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionTool.kt b/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionTool.kt index 8ca980e..1d9e725 100644 --- a/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionTool.kt +++ b/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionTool.kt @@ -7,14 +7,14 @@ import org.slf4j.LoggerFactory const val toolId = "executeJavaCode" -class JavaCodeExecutor(private val config: JavaCodeExecutionConfig) : +class JavaCodeExecutor(private val config: JavaCodeExecutionConfig?) : NonSandboxedCodeExecutor() { override fun executable(): String { - return config.executable + return config?.executable ?: "java" } override fun workingDirectory(): String? { - return config.workingDirectory + return config?.workingDirectory } override fun args(input: String): List { @@ -26,7 +26,7 @@ class JavaCodeExecutor(private val config: JavaCodeExecutionConfig) : /** * Tool to execute Java code */ -class JavaCodeExecutionTool(config: JavaCodeExecutionConfig) : +class JavaCodeExecutionTool(config: JavaCodeExecutionConfig?) : ConfigurableAgentTool { private val logger = LoggerFactory.getLogger(javaClass) diff --git a/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionToolFactory.kt b/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionToolFactory.kt index 1be792b..316da27 100644 --- a/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionToolFactory.kt +++ b/java/src/main/kotlin/io/github/llmagentbuilder/tool/javacodeexecution/JavaCodeExecutionToolFactory.kt @@ -1,16 +1,14 @@ package io.github.llmagentbuilder.tool.javacodeexecution -import io.github.llmagentbuilder.core.tool.EnvironmentVariableConfigurableAgentToolFactory +import io.github.llmagentbuilder.core.tool.ConfigurableAgentToolFactory class JavaCodeExecutionToolFactory : - EnvironmentVariableConfigurableAgentToolFactory( - JavaCodeExecutionConfig::class.java, "${toolId}_" - ) { - override fun create(config: JavaCodeExecutionConfig): JavaCodeExecutionTool { + ConfigurableAgentToolFactory { + override fun create(config: JavaCodeExecutionConfig?): JavaCodeExecutionTool { return JavaCodeExecutionTool(config) } - override fun configName(): String { + override fun toolId(): String { return toolId } } \ No newline at end of file diff --git a/python/src/main/java/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionConfig.java b/python/src/main/java/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionConfig.java index 0e478f6..c36922d 100644 --- a/python/src/main/java/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionConfig.java +++ b/python/src/main/java/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionConfig.java @@ -2,7 +2,7 @@ public class PythonCodeExecutionConfig { - private String executable = "python"; + private String executable; private String workingDirectory; diff --git a/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionTool.kt b/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionTool.kt index 9f69a5d..74c9eea 100644 --- a/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionTool.kt +++ b/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionTool.kt @@ -7,14 +7,14 @@ import org.slf4j.LoggerFactory const val toolId = "executePythonCode" -class PythonCodeExecutor(private val config: PythonCodeExecutionConfig) : +class PythonCodeExecutor(private val config: PythonCodeExecutionConfig?) : NonSandboxedCodeExecutor() { override fun executable(): String { - return config.executable + return config?.executable ?: "python" } override fun workingDirectory(): String? { - return config.workingDirectory + return config?.workingDirectory } override fun args(input: String): List { @@ -26,7 +26,7 @@ class PythonCodeExecutor(private val config: PythonCodeExecutionConfig) : /** * Tool to execute Python code */ -class PythonCodeExecutionTool(config: PythonCodeExecutionConfig) : +class PythonCodeExecutionTool(config: PythonCodeExecutionConfig?) : ConfigurableAgentTool { private val logger = LoggerFactory.getLogger(javaClass) diff --git a/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionToolFactory.kt b/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionToolFactory.kt index 92b49c3..bff8b31 100644 --- a/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionToolFactory.kt +++ b/python/src/main/kotlin/io/github/llmagentbuilder/tool/pythoncodeexecution/PythonCodeExecutionToolFactory.kt @@ -1,16 +1,14 @@ package io.github.llmagentbuilder.tool.pythoncodeexecution -import io.github.llmagentbuilder.core.tool.EnvironmentVariableConfigurableAgentToolFactory +import io.github.llmagentbuilder.core.tool.ConfigurableAgentToolFactory class PythonCodeExecutionToolFactory : - EnvironmentVariableConfigurableAgentToolFactory( - PythonCodeExecutionConfig::class.java, "${toolId}_" - ) { - override fun create(config: PythonCodeExecutionConfig): PythonCodeExecutionTool { + ConfigurableAgentToolFactory { + override fun create(config: PythonCodeExecutionConfig?): PythonCodeExecutionTool { return PythonCodeExecutionTool(config) } - override fun configName(): String { + override fun toolId(): String { return toolId } } \ No newline at end of file