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

io.github.sashirestela.openai.domain.audio.TranscriptionRequest Maven / Gradle / Ivy

There is a newer version: 3.9.2
Show newest version
package io.github.sashirestela.openai.domain.audio;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.github.sashirestela.slimvalidator.constraints.Extension;
import io.github.sashirestela.slimvalidator.constraints.Range;
import io.github.sashirestela.slimvalidator.constraints.Required;
import io.github.sashirestela.slimvalidator.constraints.Size;
import lombok.Builder;
import lombok.Getter;
import lombok.Singular;
import lombok.With;

import java.nio.file.Path;
import java.util.Set;

@Getter
@Builder
@JsonInclude(Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class TranscriptionRequest {

    @Required
    @Extension({ "flac", "mp3", "mp4", "mpeg", "mpga", "m4a", "ogg", "wav", "webm" })
    private Path file;

    @Required
    private String model;

    private String language;

    private String prompt;

    @With
    private AudioResponseFormat responseFormat;

    @Range(min = 0.0, max = 1.0)
    private Double temperature;

    @Singular
    @Size(max = 2)
    private Set timestampGranularities;

    public enum TimestampGranularity {

        @JsonProperty("word")
        WORD,

        @JsonProperty("segment")
        SEGMENT;

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy