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

com.cohere.api.requests.DetokenizeRequest Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
/**
 * This file was auto-generated by Fern from our API Definition.
 */
package com.cohere.api.requests;

import com.cohere.api.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = DetokenizeRequest.Builder.class)
public final class DetokenizeRequest {
    private final List tokens;

    private final String model;

    private final Map additionalProperties;

    private DetokenizeRequest(List tokens, String model, Map additionalProperties) {
        this.tokens = tokens;
        this.model = model;
        this.additionalProperties = additionalProperties;
    }

    /**
     * @return The list of tokens to be detokenized.
     */
    @JsonProperty("tokens")
    public List getTokens() {
        return tokens;
    }

    /**
     * @return An optional parameter to provide the model name. This will ensure that the detokenization is done by the tokenizer used by that model.
     */
    @JsonProperty("model")
    public String getModel() {
        return model;
    }

    @java.lang.Override
    public boolean equals(Object other) {
        if (this == other) return true;
        return other instanceof DetokenizeRequest && equalTo((DetokenizeRequest) other);
    }

    @JsonAnyGetter
    public Map getAdditionalProperties() {
        return this.additionalProperties;
    }

    private boolean equalTo(DetokenizeRequest other) {
        return tokens.equals(other.tokens) && model.equals(other.model);
    }

    @java.lang.Override
    public int hashCode() {
        return Objects.hash(this.tokens, this.model);
    }

    @java.lang.Override
    public String toString() {
        return ObjectMappers.stringify(this);
    }

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

    public interface ModelStage {
        _FinalStage model(String model);

        Builder from(DetokenizeRequest other);
    }

    public interface _FinalStage {
        DetokenizeRequest build();

        _FinalStage tokens(List tokens);

        _FinalStage addTokens(Integer tokens);

        _FinalStage addAllTokens(List tokens);
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder implements ModelStage, _FinalStage {
        private String model;

        private List tokens = new ArrayList<>();

        @JsonAnySetter
        private Map additionalProperties = new HashMap<>();

        private Builder() {}

        @java.lang.Override
        public Builder from(DetokenizeRequest other) {
            tokens(other.getTokens());
            model(other.getModel());
            return this;
        }

        /**
         * 

An optional parameter to provide the model name. This will ensure that the detokenization is done by the tokenizer used by that model.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @JsonSetter("model") public _FinalStage model(String model) { this.model = model; return this; } /** *

The list of tokens to be detokenized.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage addAllTokens(List tokens) { this.tokens.addAll(tokens); return this; } /** *

The list of tokens to be detokenized.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage addTokens(Integer tokens) { this.tokens.add(tokens); return this; } @java.lang.Override @JsonSetter(value = "tokens", nulls = Nulls.SKIP) public _FinalStage tokens(List tokens) { this.tokens.clear(); this.tokens.addAll(tokens); return this; } @java.lang.Override public DetokenizeRequest build() { return new DetokenizeRequest(tokens, model, additionalProperties); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy