All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.unitmesh.prompt.executor.strategy.RepeatExecuteStrategy.kt Maven / Gradle / Ivy

Go to download

Chocolate Factory is a cutting-edge LLM toolkit designed to empower you in creating your very own AI assistant.

There is a newer version: 1.0.0
Show newest version
package cc.unitmesh.prompt.executor.strategy

import cc.unitmesh.prompt.executor.base.SingleJobExecuteStrategy
import cc.unitmesh.prompt.model.Job
import cc.unitmesh.prompt.model.JobStrategy
import java.nio.file.Path

class RepeatExecuteStrategy(
    override val jobName: String,
    override val job: Job,
    override val basePath: Path,
    private val strategy: JobStrategy.Repeat,
) : SingleJobExecuteStrategy(jobName, job, basePath) {
    override fun execute() {
        repeat(strategy.value) { index ->
            log.info("execute job: $jobName, strategy: repeat, times: ${index}/${strategy.value}")
            val llmResult = execSingleJob(jobName, job)
            handleJobResult(jobName, job, llmResult)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy