"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AiLlmEndpointParamsGoogle = void 0;
exports.serializeAiLlmEndpointParamsGoogleTypeField = serializeAiLlmEndpointParamsGoogleTypeField;
exports.deserializeAiLlmEndpointParamsGoogleTypeField = deserializeAiLlmEndpointParamsGoogleTypeField;
exports.serializeAiLlmEndpointParamsGoogle = serializeAiLlmEndpointParamsGoogle;
exports.deserializeAiLlmEndpointParamsGoogle = deserializeAiLlmEndpointParamsGoogle;
exports.serializeAiLlmEndpointParamsGoogleInput = serializeAiLlmEndpointParamsGoogleInput;
exports.deserializeAiLlmEndpointParamsGoogleInput = deserializeAiLlmEndpointParamsGoogleInput;
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
class AiLlmEndpointParamsGoogle {
    /**
     * The type of the AI LLM endpoint params object for Google.
     * This parameter is **required**. */
    type = 'google_params';
    /**
     * The temperature is used for sampling during response generation, which occurs when `top-P` and `top-K` are applied. Temperature controls the degree of randomness in the token selection. */
    temperature;
    /**
     * `Top-P` changes how the model selects tokens for output. Tokens are selected from the most (see `top-K`) to least probable until the sum of their probabilities equals the `top-P` value. */
    topP;
    /**
     * `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected token is
     * the most probable among all tokens in the model's vocabulary (also called greedy decoding),
     * while a high `top-K` means that the next token is selected from among the three most probable tokens by using temperature. */
    topK;
    rawData;
    constructor(fields) {
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.temperature !== undefined) {
            this.temperature = fields.temperature;
        }
        if (fields.topP !== undefined) {
            this.topP = fields.topP;
        }
        if (fields.topK !== undefined) {
            this.topK = fields.topK;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.AiLlmEndpointParamsGoogle = AiLlmEndpointParamsGoogle;
function serializeAiLlmEndpointParamsGoogleTypeField(val) {
    return val;
}
function deserializeAiLlmEndpointParamsGoogleTypeField(val) {
    if (val == 'google_params') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize AiLlmEndpointParamsGoogleTypeField",
    });
}
function serializeAiLlmEndpointParamsGoogle(val) {
    return {
        ['type']: serializeAiLlmEndpointParamsGoogleTypeField(val.type),
        ['temperature']: val.temperature,
        ['top_p']: val.topP,
        ['top_k']: val.topK,
    };
}
function deserializeAiLlmEndpointParamsGoogle(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AiLlmEndpointParamsGoogle"',
        });
    }
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "AiLlmEndpointParamsGoogle" to be defined',
        });
    }
    const type = deserializeAiLlmEndpointParamsGoogleTypeField(val.type);
    if (!(val.temperature == void 0) && !(0, json_1.sdIsNumber)(val.temperature)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "temperature" of type "AiLlmEndpointParamsGoogle"',
        });
    }
    const temperature = val.temperature == void 0 ? void 0 : val.temperature;
    if (!(val.top_p == void 0) && !(0, json_1.sdIsNumber)(val.top_p)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "top_p" of type "AiLlmEndpointParamsGoogle"',
        });
    }
    const topP = val.top_p == void 0 ? void 0 : val.top_p;
    if (!(val.top_k == void 0) && !(0, json_1.sdIsNumber)(val.top_k)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "top_k" of type "AiLlmEndpointParamsGoogle"',
        });
    }
    const topK = val.top_k == void 0 ? void 0 : val.top_k;
    return {
        type: type,
        temperature: temperature,
        topP: topP,
        topK: topK,
    };
}
function serializeAiLlmEndpointParamsGoogleInput(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeAiLlmEndpointParamsGoogleTypeField(val.type),
        ['temperature']: val.temperature,
        ['top_p']: val.topP,
        ['top_k']: val.topK,
    };
}
function deserializeAiLlmEndpointParamsGoogleInput(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AiLlmEndpointParamsGoogleInput"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeAiLlmEndpointParamsGoogleTypeField(val.type);
    if (!(val.temperature == void 0) && !(0, json_1.sdIsNumber)(val.temperature)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "temperature" of type "AiLlmEndpointParamsGoogleInput"',
        });
    }
    const temperature = val.temperature == void 0 ? void 0 : val.temperature;
    if (!(val.top_p == void 0) && !(0, json_1.sdIsNumber)(val.top_p)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "top_p" of type "AiLlmEndpointParamsGoogleInput"',
        });
    }
    const topP = val.top_p == void 0 ? void 0 : val.top_p;
    if (!(val.top_k == void 0) && !(0, json_1.sdIsNumber)(val.top_k)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "top_k" of type "AiLlmEndpointParamsGoogleInput"',
        });
    }
    const topK = val.top_k == void 0 ? void 0 : val.top_k;
    return {
        type: type,
        temperature: temperature,
        topP: topP,
        topK: topK,
    };
}
//# sourceMappingURL=aiLlmEndpointParamsGoogle.js.map