Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcheng1982 committed Oct 4, 2024
1 parent 236810b commit 6799533
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 174 deletions.
4 changes: 0 additions & 4 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.github.llmagentbuilder.core.tool

import io.github.llmagentbuilder.core.MapToObject
import org.apache.commons.beanutils.BeanUtils
import java.util.function.Supplier

/**
Expand Down Expand Up @@ -48,55 +46,3 @@ abstract class BaseConfigurableAgentToolFactory<out T : ConfigurableAgentTool<*,
return create(configProvider.get())
}
}

class MapConfigProvider<C>(
private val configClass: Class<C>,
private val config: Map<String, Any?>
) : Supplier<C?> {
override fun get(): C? {
return MapToObject.toObject(configClass, config)
}
}

abstract class MapConfigurableAgentToolFactory<out T : ConfigurableAgentTool<*, *, CONFIG>, CONFIG>(
configClass: Class<CONFIG>,
config: Map<String, Any?>,
) : BaseConfigurableAgentToolFactory<T, CONFIG>(
MapConfigProvider(
configClass,
config
)
)

abstract class EnvironmentVariableConfigurableAgentToolFactory<out T : ConfigurableAgentTool<*, *, CONFIG>, CONFIG>(
configClass: Class<CONFIG>,
environmentVariablePrefix: String
) :
BaseConfigurableAgentToolFactory<T, CONFIG>(
EnvironmentVariableConfigProvider(
configClass,
environmentVariablePrefix
)
)

open class EnvironmentVariableConfigProvider<C>(
private val configClass: Class<C>,
private val environmentVariablePrefix: String
) :
Supplier<C?> {
override fun get(): C? {
val instance = configClass.getDeclaredConstructor().newInstance()
BeanUtils.populate(instance, getEnvironmentVariables())
return instance
}

private fun getEnvironmentVariables(): Map<String, String> {
val prefix = environmentVariablePrefix
return System.getenv()
.filterKeys {
it.startsWith(prefix)
}.mapKeys { entry ->
entry.key.removePrefix(prefix)
}
}
}

This file was deleted.

25 changes: 0 additions & 25 deletions core/src/test/resources/output_parser/ReActJson/code.txt

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions core/src/test/resources/output_parser/ReActJson/python-code.txt

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down

0 comments on commit 6799533

Please sign in to comment.