From d2fd1ec4bddb19b353e286908c99477e08b90457 Mon Sep 17 00:00:00 2001 From: box-sdk-build <94016436+box-sdk-build@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:23:07 +0100 Subject: [PATCH] feat: add AI LLM endpoint AWS `params` (box/box-openapi#478) (#388) --- .codegen.json | 2 +- src/schemas/aiAgentBasicGenTool.generated.ts | 10 +- src/schemas/aiAgentBasicTextTool.generated.ts | 10 +- .../aiAgentBasicTextToolBase.generated.ts | 14 +- .../aiAgentBasicTextToolTextGen.generated.ts | 10 +- src/schemas/aiAgentLongTextTool.generated.ts | 10 +- .../aiAgentLongTextToolTextGen.generated.ts | 10 +- .../aiLlmEndpointParamsAws.generated.ts | 166 ++++++++++++++++++ ...eOrAiLlmEndpointParamsOpenAi.generated.ts} | 27 ++- 9 files changed, 218 insertions(+), 41 deletions(-) create mode 100644 src/schemas/aiLlmEndpointParamsAws.generated.ts rename src/schemas/{aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts => aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts} (58%) diff --git a/.codegen.json b/.codegen.json index 9faf0a42..a6970d32 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "2efc8ab", "specHash": "e798cb1", "version": "1.7.0" } +{ "engineHash": "2efc8ab", "specHash": "90cf4e4", "version": "1.7.0" } diff --git a/src/schemas/aiAgentBasicGenTool.generated.ts b/src/schemas/aiAgentBasicGenTool.generated.ts index 7d4e6548..ef3e50e5 100644 --- a/src/schemas/aiAgentBasicGenTool.generated.ts +++ b/src/schemas/aiAgentBasicGenTool.generated.ts @@ -1,5 +1,5 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { serializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { deserializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { serializeAiAgentBasicTextToolTextGen } from './aiAgentBasicTextToolTextGen.generated.js'; @@ -8,7 +8,7 @@ import { serializeAiAgentLongTextToolTextGenEmbeddingsField } from './aiAgentLon import { deserializeAiAgentLongTextToolTextGenEmbeddingsField } from './aiAgentLongTextToolTextGen.generated.js'; import { serializeAiAgentLongTextToolTextGen } from './aiAgentLongTextToolTextGen.generated.js'; import { deserializeAiAgentLongTextToolTextGen } from './aiAgentLongTextToolTextGen.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { AiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { AiAgentBasicTextToolTextGen } from './aiAgentBasicTextToolTextGen.generated.js'; import { AiAgentLongTextToolTextGenEmbeddingsField } from './aiAgentLongTextToolTextGen.generated.js'; @@ -101,10 +101,10 @@ export function deserializeAiAgentBasicGenTool( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiAgentBasicTextTool.generated.ts b/src/schemas/aiAgentBasicTextTool.generated.ts index da240879..a20686e3 100644 --- a/src/schemas/aiAgentBasicTextTool.generated.ts +++ b/src/schemas/aiAgentBasicTextTool.generated.ts @@ -1,8 +1,8 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { serializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { deserializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { AiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; @@ -86,10 +86,10 @@ export function deserializeAiAgentBasicTextTool( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiAgentBasicTextToolBase.generated.ts b/src/schemas/aiAgentBasicTextToolBase.generated.ts index a927975a..699e032f 100644 --- a/src/schemas/aiAgentBasicTextToolBase.generated.ts +++ b/src/schemas/aiAgentBasicTextToolBase.generated.ts @@ -1,6 +1,6 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; @@ -18,7 +18,7 @@ export interface AiAgentBasicTextToolBase { readonly numTokensForCompletion?: number; /** * The parameters for the LLM endpoint specific to OpenAI / Google models. */ - readonly llmEndpointParams?: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi; + readonly llmEndpointParams?: AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi; readonly rawData?: SerializedData; } export function serializeAiAgentBasicTextToolBase( @@ -33,7 +33,7 @@ export function serializeAiAgentBasicTextToolBase( ['llm_endpoint_params']: val.llmEndpointParams == void 0 ? void 0 - : serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llmEndpointParams ), }; @@ -68,10 +68,10 @@ export function deserializeAiAgentBasicTextToolBase( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiAgentBasicTextToolTextGen.generated.ts b/src/schemas/aiAgentBasicTextToolTextGen.generated.ts index 496b3e76..34ac2a7c 100644 --- a/src/schemas/aiAgentBasicTextToolTextGen.generated.ts +++ b/src/schemas/aiAgentBasicTextToolTextGen.generated.ts @@ -1,8 +1,8 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { serializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { deserializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { AiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; @@ -89,10 +89,10 @@ export function deserializeAiAgentBasicTextToolTextGen( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiAgentLongTextTool.generated.ts b/src/schemas/aiAgentLongTextTool.generated.ts index 766d2c53..b0736dab 100644 --- a/src/schemas/aiAgentLongTextTool.generated.ts +++ b/src/schemas/aiAgentLongTextTool.generated.ts @@ -1,10 +1,10 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { serializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { deserializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { serializeAiAgentBasicTextTool } from './aiAgentBasicTextTool.generated.js'; import { deserializeAiAgentBasicTextTool } from './aiAgentBasicTextTool.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { AiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { AiAgentBasicTextTool } from './aiAgentBasicTextTool.generated.js'; import { BoxSdkError } from '../box/errors.js'; @@ -178,10 +178,10 @@ export function deserializeAiAgentLongTextTool( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiAgentLongTextToolTextGen.generated.ts b/src/schemas/aiAgentLongTextToolTextGen.generated.ts index 64773551..54c6921d 100644 --- a/src/schemas/aiAgentLongTextToolTextGen.generated.ts +++ b/src/schemas/aiAgentLongTextToolTextGen.generated.ts @@ -1,10 +1,10 @@ -import { serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; -import { deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { serializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { deserializeAiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { serializeAiAgentBasicTextToolTextGen } from './aiAgentBasicTextToolTextGen.generated.js'; import { deserializeAiAgentBasicTextToolTextGen } from './aiAgentBasicTextToolTextGen.generated.js'; -import { AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.js'; import { AiAgentBasicTextToolBase } from './aiAgentBasicTextToolBase.generated.js'; import { AiAgentBasicTextToolTextGen } from './aiAgentBasicTextToolTextGen.generated.js'; import { BoxSdkError } from '../box/errors.js'; @@ -186,10 +186,10 @@ export function deserializeAiAgentLongTextToolTextGen( : val.num_tokens_for_completion; const llmEndpointParams: | undefined - | AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + | AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = val.llm_endpoint_params == void 0 ? void 0 - : deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( + : deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val.llm_endpoint_params ); return { diff --git a/src/schemas/aiLlmEndpointParamsAws.generated.ts b/src/schemas/aiLlmEndpointParamsAws.generated.ts new file mode 100644 index 00000000..93912e20 --- /dev/null +++ b/src/schemas/aiLlmEndpointParamsAws.generated.ts @@ -0,0 +1,166 @@ +import { BoxSdkError } from '../box/errors.js'; +import { SerializedData } from '../serialization/json.js'; +import { sdIsEmpty } from '../serialization/json.js'; +import { sdIsBoolean } from '../serialization/json.js'; +import { sdIsNumber } from '../serialization/json.js'; +import { sdIsString } from '../serialization/json.js'; +import { sdIsList } from '../serialization/json.js'; +import { sdIsMap } from '../serialization/json.js'; +export type AiLlmEndpointParamsAwsTypeField = 'aws_params'; +export class AiLlmEndpointParamsAws { + /** + * The type of the AI LLM endpoint params object for AWS. + * This parameter is **required**. */ + readonly type: AiLlmEndpointParamsAwsTypeField = + 'aws_params' as AiLlmEndpointParamsAwsTypeField; + /** + * What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * We generally recommend altering this or `top_p` but not both. */ + readonly temperature?: number; + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results + * of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability + * mass are considered. We generally recommend altering this or temperature but not both. */ + readonly topP?: number; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.type) { + this.type = fields.type; + } + if (fields.temperature) { + this.temperature = fields.temperature; + } + if (fields.topP) { + this.topP = fields.topP; + } + if (fields.rawData) { + this.rawData = fields.rawData; + } + } +} +export interface AiLlmEndpointParamsAwsInput { + /** + * The type of the AI LLM endpoint params object for AWS. + * This parameter is **required**. */ + readonly type?: AiLlmEndpointParamsAwsTypeField; + /** + * What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + * We generally recommend altering this or `top_p` but not both. */ + readonly temperature?: number; + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results + * of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability + * mass are considered. We generally recommend altering this or temperature but not both. */ + readonly topP?: number; + readonly rawData?: SerializedData; +} +export function serializeAiLlmEndpointParamsAwsTypeField( + val: AiLlmEndpointParamsAwsTypeField +): SerializedData { + return val; +} +export function deserializeAiLlmEndpointParamsAwsTypeField( + val: SerializedData +): AiLlmEndpointParamsAwsTypeField { + if (val == 'aws_params') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize AiLlmEndpointParamsAwsTypeField", + }); +} +export function serializeAiLlmEndpointParamsAws( + val: AiLlmEndpointParamsAws +): SerializedData { + return { + ['type']: serializeAiLlmEndpointParamsAwsTypeField(val.type), + ['temperature']: val.temperature == void 0 ? void 0 : val.temperature, + ['top_p']: val.topP == void 0 ? void 0 : val.topP, + }; +} +export function deserializeAiLlmEndpointParamsAws( + val: SerializedData +): AiLlmEndpointParamsAws { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiLlmEndpointParamsAws"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "AiLlmEndpointParamsAws" to be defined', + }); + } + const type: AiLlmEndpointParamsAwsTypeField = + deserializeAiLlmEndpointParamsAwsTypeField(val.type); + if (!(val.temperature == void 0) && !sdIsNumber(val.temperature)) { + throw new BoxSdkError({ + message: + 'Expecting number for "temperature" of type "AiLlmEndpointParamsAws"', + }); + } + const temperature: undefined | number = + val.temperature == void 0 ? void 0 : val.temperature; + if (!(val.top_p == void 0) && !sdIsNumber(val.top_p)) { + throw new BoxSdkError({ + message: 'Expecting number for "top_p" of type "AiLlmEndpointParamsAws"', + }); + } + const topP: undefined | number = val.top_p == void 0 ? void 0 : val.top_p; + return { + type: type, + temperature: temperature, + topP: topP, + } satisfies AiLlmEndpointParamsAws; +} +export function serializeAiLlmEndpointParamsAwsInput( + val: AiLlmEndpointParamsAwsInput +): SerializedData { + return { + ['type']: + val.type == void 0 + ? void 0 + : serializeAiLlmEndpointParamsAwsTypeField(val.type), + ['temperature']: val.temperature == void 0 ? void 0 : val.temperature, + ['top_p']: val.topP == void 0 ? void 0 : val.topP, + }; +} +export function deserializeAiLlmEndpointParamsAwsInput( + val: SerializedData +): AiLlmEndpointParamsAwsInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiLlmEndpointParamsAwsInput"', + }); + } + const type: undefined | AiLlmEndpointParamsAwsTypeField = + val.type == void 0 + ? void 0 + : deserializeAiLlmEndpointParamsAwsTypeField(val.type); + if (!(val.temperature == void 0) && !sdIsNumber(val.temperature)) { + throw new BoxSdkError({ + message: + 'Expecting number for "temperature" of type "AiLlmEndpointParamsAwsInput"', + }); + } + const temperature: undefined | number = + val.temperature == void 0 ? void 0 : val.temperature; + if (!(val.top_p == void 0) && !sdIsNumber(val.top_p)) { + throw new BoxSdkError({ + message: + 'Expecting number for "top_p" of type "AiLlmEndpointParamsAwsInput"', + }); + } + const topP: undefined | number = val.top_p == void 0 ? void 0 : val.top_p; + return { + type: type, + temperature: temperature, + topP: topP, + } satisfies AiLlmEndpointParamsAwsInput; +} diff --git a/src/schemas/aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts b/src/schemas/aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts similarity index 58% rename from src/schemas/aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts rename to src/schemas/aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts index 923e4584..bb265fa8 100644 --- a/src/schemas/aiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts +++ b/src/schemas/aiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.generated.ts @@ -1,7 +1,10 @@ +import { serializeAiLlmEndpointParamsAws } from './aiLlmEndpointParamsAws.generated.js'; +import { deserializeAiLlmEndpointParamsAws } from './aiLlmEndpointParamsAws.generated.js'; import { serializeAiLlmEndpointParamsGoogle } from './aiLlmEndpointParamsGoogle.generated.js'; import { deserializeAiLlmEndpointParamsGoogle } from './aiLlmEndpointParamsGoogle.generated.js'; import { serializeAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsOpenAi.generated.js'; import { deserializeAiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsOpenAi.generated.js'; +import { AiLlmEndpointParamsAws } from './aiLlmEndpointParamsAws.generated.js'; import { AiLlmEndpointParamsGoogle } from './aiLlmEndpointParamsGoogle.generated.js'; import { AiLlmEndpointParamsOpenAi } from './aiLlmEndpointParamsOpenAi.generated.js'; import { BoxSdkError } from '../box/errors.js'; @@ -12,12 +15,17 @@ import { sdIsNumber } from '../serialization/json.js'; import { sdIsString } from '../serialization/json.js'; import { sdIsList } from '../serialization/json.js'; import { sdIsMap } from '../serialization/json.js'; -export type AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = - | AiLlmEndpointParamsGoogle - | AiLlmEndpointParamsOpenAi; -export function serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( +export type AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi = + + | AiLlmEndpointParamsAws + | AiLlmEndpointParamsGoogle + | AiLlmEndpointParamsOpenAi; +export function serializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val: any ): SerializedData { + if (val.type == 'aws_params') { + return serializeAiLlmEndpointParamsAws(val); + } if (val.type == 'google_params') { return serializeAiLlmEndpointParamsGoogle(val); } @@ -26,15 +34,18 @@ export function serializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( } throw new BoxSdkError({ message: 'unknown type' }); } -export function deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( +export function deserializeAiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( val: SerializedData -): AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi { +): AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi { if (!sdIsMap(val)) { throw new BoxSdkError({ message: - 'Expecting a map for "AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi"', + 'Expecting a map for "AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi"', }); } + if (val.type == 'aws_params') { + return deserializeAiLlmEndpointParamsAws(val); + } if (val.type == 'google_params') { return deserializeAiLlmEndpointParamsGoogle(val); } @@ -43,6 +54,6 @@ export function deserializeAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi( } throw new BoxSdkError({ message: - "Can't deserialize AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi", + "Can't deserialize AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi", }); }