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

com.cohere.api.resources.datasets.requests.DatasetsCreateRequest 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.resources.datasets.requests;

import com.cohere.api.core.ObjectMappers;
import com.cohere.api.types.DatasetType;
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.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = DatasetsCreateRequest.Builder.class)
public final class DatasetsCreateRequest {
    private final String name;

    private final DatasetType type;

    private final Optional keepOriginalFile;

    private final Optional skipMalformedInput;

    private final Optional keepFields;

    private final Optional optionalFields;

    private final Optional textSeparator;

    private final Optional csvDelimiter;

    private final Optional dryRun;

    private final Map additionalProperties;

    private DatasetsCreateRequest(
            String name,
            DatasetType type,
            Optional keepOriginalFile,
            Optional skipMalformedInput,
            Optional keepFields,
            Optional optionalFields,
            Optional textSeparator,
            Optional csvDelimiter,
            Optional dryRun,
            Map additionalProperties) {
        this.name = name;
        this.type = type;
        this.keepOriginalFile = keepOriginalFile;
        this.skipMalformedInput = skipMalformedInput;
        this.keepFields = keepFields;
        this.optionalFields = optionalFields;
        this.textSeparator = textSeparator;
        this.csvDelimiter = csvDelimiter;
        this.dryRun = dryRun;
        this.additionalProperties = additionalProperties;
    }

    /**
     * @return The name of the uploaded dataset.
     */
    @JsonProperty("name")
    public String getName() {
        return name;
    }

    /**
     * @return The dataset type, which is used to validate the data. Valid types are embed-input, reranker-finetune-input, single-label-classification-finetune-input, chat-finetune-input, and multi-label-classification-finetune-input.
     */
    @JsonProperty("type")
    public DatasetType getType() {
        return type;
    }

    /**
     * @return Indicates if the original file should be stored.
     */
    @JsonProperty("keep_original_file")
    public Optional getKeepOriginalFile() {
        return keepOriginalFile;
    }

    /**
     * @return Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.
     */
    @JsonProperty("skip_malformed_input")
    public Optional getSkipMalformedInput() {
        return skipMalformedInput;
    }

    /**
     * @return List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the schema for the corresponding Dataset type. For example, datasets of type embed-input will drop all fields other than the required text field. If any of the fields in keep_fields are missing from the uploaded file, Dataset validation will fail.
     */
    @JsonProperty("keep_fields")
    public Optional getKeepFields() {
        return keepFields;
    }

    /**
     * @return List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the schema for the corresponding Dataset type. For example, Datasets of type embed-input will drop all fields other than the required text field. If any of the fields in optional_fields are missing from the uploaded file, Dataset validation will pass.
     */
    @JsonProperty("optional_fields")
    public Optional getOptionalFields() {
        return optionalFields;
    }

    /**
     * @return Raw .txt uploads will be split into entries using the text_separator value.
     */
    @JsonProperty("text_separator")
    public Optional getTextSeparator() {
        return textSeparator;
    }

    /**
     * @return The delimiter used for .csv uploads.
     */
    @JsonProperty("csv_delimiter")
    public Optional getCsvDelimiter() {
        return csvDelimiter;
    }

    /**
     * @return flag to enable dry_run mode
     */
    @JsonProperty("dry_run")
    public Optional getDryRun() {
        return dryRun;
    }

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

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

    private boolean equalTo(DatasetsCreateRequest other) {
        return name.equals(other.name)
                && type.equals(other.type)
                && keepOriginalFile.equals(other.keepOriginalFile)
                && skipMalformedInput.equals(other.skipMalformedInput)
                && keepFields.equals(other.keepFields)
                && optionalFields.equals(other.optionalFields)
                && textSeparator.equals(other.textSeparator)
                && csvDelimiter.equals(other.csvDelimiter)
                && dryRun.equals(other.dryRun);
    }

    @java.lang.Override
    public int hashCode() {
        return Objects.hash(
                this.name,
                this.type,
                this.keepOriginalFile,
                this.skipMalformedInput,
                this.keepFields,
                this.optionalFields,
                this.textSeparator,
                this.csvDelimiter,
                this.dryRun);
    }

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

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

    public interface NameStage {
        TypeStage name(String name);

        Builder from(DatasetsCreateRequest other);
    }

    public interface TypeStage {
        _FinalStage type(DatasetType type);
    }

    public interface _FinalStage {
        DatasetsCreateRequest build();

        _FinalStage keepOriginalFile(Optional keepOriginalFile);

        _FinalStage keepOriginalFile(Boolean keepOriginalFile);

        _FinalStage skipMalformedInput(Optional skipMalformedInput);

        _FinalStage skipMalformedInput(Boolean skipMalformedInput);

        _FinalStage keepFields(Optional keepFields);

        _FinalStage keepFields(String keepFields);

        _FinalStage optionalFields(Optional optionalFields);

        _FinalStage optionalFields(String optionalFields);

        _FinalStage textSeparator(Optional textSeparator);

        _FinalStage textSeparator(String textSeparator);

        _FinalStage csvDelimiter(Optional csvDelimiter);

        _FinalStage csvDelimiter(String csvDelimiter);

        _FinalStage dryRun(Optional dryRun);

        _FinalStage dryRun(Boolean dryRun);
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder implements NameStage, TypeStage, _FinalStage {
        private String name;

        private DatasetType type;

        private Optional dryRun = Optional.empty();

        private Optional csvDelimiter = Optional.empty();

        private Optional textSeparator = Optional.empty();

        private Optional optionalFields = Optional.empty();

        private Optional keepFields = Optional.empty();

        private Optional skipMalformedInput = Optional.empty();

        private Optional keepOriginalFile = Optional.empty();

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

        private Builder() {}

        @java.lang.Override
        public Builder from(DatasetsCreateRequest other) {
            name(other.getName());
            type(other.getType());
            keepOriginalFile(other.getKeepOriginalFile());
            skipMalformedInput(other.getSkipMalformedInput());
            keepFields(other.getKeepFields());
            optionalFields(other.getOptionalFields());
            textSeparator(other.getTextSeparator());
            csvDelimiter(other.getCsvDelimiter());
            dryRun(other.getDryRun());
            return this;
        }

        /**
         * 

The name of the uploaded dataset.

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

The dataset type, which is used to validate the data. Valid types are embed-input, reranker-finetune-input, single-label-classification-finetune-input, chat-finetune-input, and multi-label-classification-finetune-input.

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

flag to enable dry_run mode

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage dryRun(Boolean dryRun) { this.dryRun = Optional.of(dryRun); return this; } @java.lang.Override @JsonSetter(value = "dry_run", nulls = Nulls.SKIP) public _FinalStage dryRun(Optional dryRun) { this.dryRun = dryRun; return this; } /** *

The delimiter used for .csv uploads.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage csvDelimiter(String csvDelimiter) { this.csvDelimiter = Optional.of(csvDelimiter); return this; } @java.lang.Override @JsonSetter(value = "csv_delimiter", nulls = Nulls.SKIP) public _FinalStage csvDelimiter(Optional csvDelimiter) { this.csvDelimiter = csvDelimiter; return this; } /** *

Raw .txt uploads will be split into entries using the text_separator value.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage textSeparator(String textSeparator) { this.textSeparator = Optional.of(textSeparator); return this; } @java.lang.Override @JsonSetter(value = "text_separator", nulls = Nulls.SKIP) public _FinalStage textSeparator(Optional textSeparator) { this.textSeparator = textSeparator; return this; } /** *

List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the schema for the corresponding Dataset type. For example, Datasets of type embed-input will drop all fields other than the required text field. If any of the fields in optional_fields are missing from the uploaded file, Dataset validation will pass.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage optionalFields(String optionalFields) { this.optionalFields = Optional.of(optionalFields); return this; } @java.lang.Override @JsonSetter(value = "optional_fields", nulls = Nulls.SKIP) public _FinalStage optionalFields(Optional optionalFields) { this.optionalFields = optionalFields; return this; } /** *

List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the schema for the corresponding Dataset type. For example, datasets of type embed-input will drop all fields other than the required text field. If any of the fields in keep_fields are missing from the uploaded file, Dataset validation will fail.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage keepFields(String keepFields) { this.keepFields = Optional.of(keepFields); return this; } @java.lang.Override @JsonSetter(value = "keep_fields", nulls = Nulls.SKIP) public _FinalStage keepFields(Optional keepFields) { this.keepFields = keepFields; return this; } /** *

Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage skipMalformedInput(Boolean skipMalformedInput) { this.skipMalformedInput = Optional.of(skipMalformedInput); return this; } @java.lang.Override @JsonSetter(value = "skip_malformed_input", nulls = Nulls.SKIP) public _FinalStage skipMalformedInput(Optional skipMalformedInput) { this.skipMalformedInput = skipMalformedInput; return this; } /** *

Indicates if the original file should be stored.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override public _FinalStage keepOriginalFile(Boolean keepOriginalFile) { this.keepOriginalFile = Optional.of(keepOriginalFile); return this; } @java.lang.Override @JsonSetter(value = "keep_original_file", nulls = Nulls.SKIP) public _FinalStage keepOriginalFile(Optional keepOriginalFile) { this.keepOriginalFile = keepOriginalFile; return this; } @java.lang.Override public DatasetsCreateRequest build() { return new DatasetsCreateRequest( name, type, keepOriginalFile, skipMalformedInput, keepFields, optionalFields, textSeparator, csvDelimiter, dryRun, additionalProperties); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy