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

io.github.sashirestela.openai.domain.completion.Completion Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.github.sashirestela.openai.common.Usage;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.List;

@NoArgsConstructor
@Getter
@ToString
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class Completion {

    @JsonIgnore
    private String warning;
    private String id;
    private String object;
    private Long created;
    private String model;
    private List choices;
    private Usage usage;
    private String systemFingerprint;

    public String firstText() {
        return getChoices().get(0).getText();
    }

    @NoArgsConstructor
    @Getter
    @ToString
    @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
    public static class Choice {

        private String finishReason;
        private Integer index;
        private LogProbs logprobs;
        private String text;

        @NoArgsConstructor
        @Getter
        @ToString
        @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
        public static class LogProbs {

            private List textOffset;
            private List tokenLogprobs;
            private List tokens;
            private List> topLogprobs;

        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy