box-node-sdk
Version:
Official SDK for Box Platform APIs
70 lines • 3.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiAgentBasicTextToolTextGen = serializeAiAgentBasicTextToolTextGen;
exports.deserializeAiAgentBasicTextToolTextGen = deserializeAiAgentBasicTextToolTextGen;
const aiLlmEndpointParams_1 = require("./aiLlmEndpointParams");
const aiAgentBasicTextToolBase_1 = require("./aiAgentBasicTextToolBase");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
const json_3 = require("../serialization/json");
function serializeAiAgentBasicTextToolTextGen(val) {
const base = (0, aiAgentBasicTextToolBase_1.serializeAiAgentBasicTextToolBase)(val);
if (!(0, json_3.sdIsMap)(base)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AiAgentBasicTextToolTextGen"',
});
}
return {
...base,
...{
['system_message']: val.systemMessage,
['prompt_template']: val.promptTemplate,
},
};
}
function deserializeAiAgentBasicTextToolTextGen(val) {
if (!(0, json_3.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AiAgentBasicTextToolTextGen"',
});
}
if (!(val.system_message == void 0) && !(0, json_2.sdIsString)(val.system_message)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "system_message" of type "AiAgentBasicTextToolTextGen"',
});
}
const systemMessage = val.system_message == void 0 ? void 0 : val.system_message;
if (!(val.prompt_template == void 0) && !(0, json_2.sdIsString)(val.prompt_template)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "prompt_template" of type "AiAgentBasicTextToolTextGen"',
});
}
const promptTemplate = val.prompt_template == void 0 ? void 0 : val.prompt_template;
if (!(val.model == void 0) && !(0, json_2.sdIsString)(val.model)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "model" of type "AiAgentBasicTextToolTextGen"',
});
}
const model = val.model == void 0 ? void 0 : val.model;
if (!(val.num_tokens_for_completion == void 0) &&
!(0, json_1.sdIsNumber)(val.num_tokens_for_completion)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "num_tokens_for_completion" of type "AiAgentBasicTextToolTextGen"',
});
}
const numTokensForCompletion = val.num_tokens_for_completion == void 0
? void 0
: val.num_tokens_for_completion;
const llmEndpointParams = val.llm_endpoint_params == void 0
? void 0
: (0, aiLlmEndpointParams_1.deserializeAiLlmEndpointParams)(val.llm_endpoint_params);
return {
systemMessage: systemMessage,
promptTemplate: promptTemplate,
model: model,
numTokensForCompletion: numTokensForCompletion,
llmEndpointParams: llmEndpointParams,
};
}
//# sourceMappingURL=aiAgentBasicTextToolTextGen.js.map