package io.synor.compute;

/**
 * Options for inference operations.
 */
public class InferenceOptions {
    private final int maxTokens;
    private final double temperature;
    private final double topP;
    private final int topK;
    private final ProcessorType processor;

    private InferenceOptions(Builder builder) {
        this.maxTokens = builder.maxTokens;
        this.temperature = builder.temperature;
        this.topP = builder.topP;
        this.topK = builder.topK;
        this.processor = builder.processor;
    }

    public int getMaxTokens() {
        return maxTokens;
    }

    public double getTemperature() {
        return temperature;
    }

    public double getTopP() {
        return topP;
    }

    public int getTopK() {
        return topK;
    }

    public ProcessorType getProcessor() {
        return processor;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private int maxTokens = 256;
        private double temperature = 0.7;
        private double topP = 0.9;
        private int topK = 50;
        private ProcessorType processor = null;

        public Builder maxTokens(int maxTokens) {
            this.maxTokens = maxTokens;
            return this;
        }

        public Builder temperature(double temperature) {
            this.temperature = temperature;
            return this;
        }

        public Builder topP(double topP) {
            this.topP = topP;
            return this;
        }

        public Builder topK(int topK) {
            this.topK = topK;
            return this;
        }

        public Builder processor(ProcessorType processor) {
            this.processor = processor;
            return this;
        }

        public InferenceOptions build() {
            return new InferenceOptions(this);
        }
    }
}
