cc.unitmesh.prompt.executor.strategy.DatasourceCollectionStrategy.kt Maven / Gradle / Ivy
package cc.unitmesh.prompt.executor.strategy
import cc.unitmesh.cf.core.llms.LlmMsg
import cc.unitmesh.prompt.executor.ScriptExecutor
import cc.unitmesh.prompt.executor.base.JobStrategyExecutor
import cc.unitmesh.prompt.model.Job
import cc.unitmesh.prompt.model.JobStrategy
import cc.unitmesh.prompt.model.TemplateDatasource
import cc.unitmesh.prompt.model.Variable
import cc.unitmesh.prompt.template.TemplateDataCompile
import cc.unitmesh.template.TemplateEngineType
import cc.unitmesh.template.TemplateRoleSplitter
import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonParser
import java.math.BigDecimal
import java.nio.file.Path
class DatasourceCollectionStrategy(
val job: Job,
override val basePath: Path,
private val jobName: String,
private val collection: JobStrategy.DatasourceCollection,
) : JobStrategyExecutor {
companion object {
val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(DatasourceCollectionStrategy::class.java)
}
override fun execute() {
val data: JsonArray = loadCollection(job.templateDatasource)
data.forEach { item ->
val collection: List