From 3e7a6b8b24c372c0614ffcfc470101b9b9293071 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 30 Jan 2025 11:27:24 -0500 Subject: [PATCH 1/3] Convert enum comments to doc comments --- common/api-review/vertexai.api.md | 24 ------ docs-devsite/vertexai.md | 48 ++++++------ packages/vertexai/src/types/enums.ts | 106 +++++++++++++++++++-------- 3 files changed, 101 insertions(+), 77 deletions(-) diff --git a/common/api-review/vertexai.api.md b/common/api-review/vertexai.api.md index 041bc62451f..fa723bc9bcc 100644 --- a/common/api-review/vertexai.api.md +++ b/common/api-review/vertexai.api.md @@ -28,9 +28,7 @@ export interface BaseParams { // @public export enum BlockReason { - // (undocumented) OTHER = "OTHER", - // (undocumented) SAFETY = "SAFETY" } @@ -157,15 +155,10 @@ export interface FileDataPart { // @public export enum FinishReason { - // (undocumented) MAX_TOKENS = "MAX_TOKENS", - // (undocumented) OTHER = "OTHER", - // (undocumented) RECITATION = "RECITATION", - // (undocumented) SAFETY = "SAFETY", - // (undocumented) STOP = "STOP" } @@ -187,11 +180,8 @@ export interface FunctionCallingConfig { // @public (undocumented) export enum FunctionCallingMode { - // (undocumented) ANY = "ANY", - // (undocumented) AUTO = "AUTO", - // (undocumented) NONE = "NONE" } @@ -375,21 +365,15 @@ export interface GroundingMetadata { // @public (undocumented) export enum HarmBlockMethod { - // (undocumented) PROBABILITY = "PROBABILITY", - // (undocumented) SEVERITY = "SEVERITY" } // @public export enum HarmBlockThreshold { - // (undocumented) BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE", - // (undocumented) BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE", - // (undocumented) BLOCK_NONE = "BLOCK_NONE", - // (undocumented) BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH" } @@ -407,25 +391,17 @@ export enum HarmCategory { // @public export enum HarmProbability { - // (undocumented) HIGH = "HIGH", - // (undocumented) LOW = "LOW", - // (undocumented) MEDIUM = "MEDIUM", - // (undocumented) NEGLIGIBLE = "NEGLIGIBLE" } // @public export enum HarmSeverity { - // (undocumented) HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH", - // (undocumented) HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW", - // (undocumented) HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM", - // (undocumented) HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE" } diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index d9e26eabc5d..6c25e46f2c1 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -231,8 +231,8 @@ export declare enum BlockReason | Member | Value | Description | | --- | --- | --- | -| OTHER | "OTHER" | | -| SAFETY | "SAFETY" | | +| OTHER | "OTHER" | Content was blocked, but the reason is uncategorized. | +| SAFETY | "SAFETY" | Content was blocked by safety settings. | ## FinishReason @@ -248,11 +248,11 @@ export declare enum FinishReason | Member | Value | Description | | --- | --- | --- | -| MAX\_TOKENS | "MAX_TOKENS" | | -| OTHER | "OTHER" | | -| RECITATION | "RECITATION" | | -| SAFETY | "SAFETY" | | -| STOP | "STOP" | | +| MAX\_TOKENS | "MAX_TOKENS" | The maximum number of tokens as specified in the request was reached. | +| OTHER | "OTHER" | Unknown reason. | +| RECITATION | "RECITATION" | The candidate content was flagged for recitation reasons. | +| SAFETY | "SAFETY" | The candidate content was flagged for safety reasons. | +| STOP | "STOP" | Natural stop point of the model or provided stop sequence. | ## FunctionCallingMode @@ -267,9 +267,9 @@ export declare enum FunctionCallingMode | Member | Value | Description | | --- | --- | --- | -| ANY | "ANY" | | -| AUTO | "AUTO" | | -| NONE | "NONE" | | +| ANY | "ANY" | Model is constrained to always predicting a function call only. If "allowed\_function\_names" is set, the predicted function call will be limited to any one of "allowed\_function\_names", else the predicted function call will be any one of the provided "function\_declarations". | +| AUTO | "AUTO" | Default model behavior, model decides to predict either a function call or a natural language response. | +| NONE | "NONE" | Model will not predict any function call. Model behavior is same as when not passing any function declarations. | ## HarmBlockMethod @@ -284,8 +284,8 @@ export declare enum HarmBlockMethod | Member | Value | Description | | --- | --- | --- | -| PROBABILITY | "PROBABILITY" | | -| SEVERITY | "SEVERITY" | | +| PROBABILITY | "PROBABILITY" | The harm block method uses the probability score. | +| SEVERITY | "SEVERITY" | The harm block method uses both probability and severity scores. | ## HarmBlockThreshold @@ -301,10 +301,10 @@ export declare enum HarmBlockThreshold | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "BLOCK_LOW_AND_ABOVE" | | -| BLOCK\_MEDIUM\_AND\_ABOVE | "BLOCK_MEDIUM_AND_ABOVE" | | -| BLOCK\_NONE | "BLOCK_NONE" | | -| BLOCK\_ONLY\_HIGH | "BLOCK_ONLY_HIGH" | | +| BLOCK\_LOW\_AND\_ABOVE | "BLOCK_LOW_AND_ABOVE" | Content with NEGLIGIBLE will be allowed. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "BLOCK_MEDIUM_AND_ABOVE" | Content with NEGLIGIBLE and LOW will be allowed. | +| BLOCK\_NONE | "BLOCK_NONE" | All content will be allowed. | +| BLOCK\_ONLY\_HIGH | "BLOCK_ONLY_HIGH" | Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. | ## HarmCategory @@ -339,10 +339,10 @@ export declare enum HarmProbability | Member | Value | Description | | --- | --- | --- | -| HIGH | "HIGH" | | -| LOW | "LOW" | | -| MEDIUM | "MEDIUM" | | -| NEGLIGIBLE | "NEGLIGIBLE" | | +| HIGH | "HIGH" | Content has a high chance of being unsafe. | +| LOW | "LOW" | Content has a low chance of being unsafe. | +| MEDIUM | "MEDIUM" | Content has a medium chance of being unsafe. | +| NEGLIGIBLE | "NEGLIGIBLE" | Content has a negligible chance of being unsafe. | ## HarmSeverity @@ -358,10 +358,10 @@ export declare enum HarmSeverity | Member | Value | Description | | --- | --- | --- | -| HARM\_SEVERITY\_HIGH | "HARM_SEVERITY_HIGH" | | -| HARM\_SEVERITY\_LOW | "HARM_SEVERITY_LOW" | | -| HARM\_SEVERITY\_MEDIUM | "HARM_SEVERITY_MEDIUM" | | -| HARM\_SEVERITY\_NEGLIGIBLE | "HARM_SEVERITY_NEGLIGIBLE" | | +| HARM\_SEVERITY\_HIGH | "HARM_SEVERITY_HIGH" | High level of harm severity. | +| HARM\_SEVERITY\_LOW | "HARM_SEVERITY_LOW" | Low level of harm severity. | +| HARM\_SEVERITY\_MEDIUM | "HARM_SEVERITY_MEDIUM" | Medium level of harm severity. | +| HARM\_SEVERITY\_NEGLIGIBLE | "HARM_SEVERITY_NEGLIGIBLE" | Negligible level of harm severity. | ## SchemaType diff --git a/packages/vertexai/src/types/enums.ts b/packages/vertexai/src/types/enums.ts index 3e66bacc612..b3d2a1b4fd7 100644 --- a/packages/vertexai/src/types/enums.ts +++ b/packages/vertexai/src/types/enums.ts @@ -43,13 +43,21 @@ export enum HarmCategory { * @public */ export enum HarmBlockThreshold { - // Content with NEGLIGIBLE will be allowed. + /** + * Content with NEGLIGIBLE will be allowed. + */ BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE', - // Content with NEGLIGIBLE and LOW will be allowed. + /** + * Content with NEGLIGIBLE and LOW will be allowed. + */ BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE', - // Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. + /** + * Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. + */ BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH', - // All content will be allowed. + /** + * All content will be allowed. + */ BLOCK_NONE = 'BLOCK_NONE' } @@ -57,9 +65,13 @@ export enum HarmBlockThreshold { * @public */ export enum HarmBlockMethod { - // The harm block method uses both probability and severity scores. + /** + * The harm block method uses both probability and severity scores. + */ SEVERITY = 'SEVERITY', - // The harm block method uses the probability score. + /** + * The harm block method uses the probability score. + */ PROBABILITY = 'PROBABILITY' } @@ -68,13 +80,21 @@ export enum HarmBlockMethod { * @public */ export enum HarmProbability { - // Content has a negligible chance of being unsafe. + /** + * Content has a negligible chance of being unsafe. + */ NEGLIGIBLE = 'NEGLIGIBLE', - // Content has a low chance of being unsafe. + /** + * Content has a low chance of being unsafe. + */ LOW = 'LOW', - // Content has a medium chance of being unsafe. + /** + * Content has a medium chance of being unsafe. + */ MEDIUM = 'MEDIUM', - // Content has a high chance of being unsafe. + /** + * Content has a high chance of being unsafe. + */ HIGH = 'HIGH' } @@ -83,13 +103,21 @@ export enum HarmProbability { * @public */ export enum HarmSeverity { - // Negligible level of harm severity. + /** + * Negligible level of harm severity. + */ HARM_SEVERITY_NEGLIGIBLE = 'HARM_SEVERITY_NEGLIGIBLE', - // Low level of harm severity. + /** + * Low level of harm severity. + */ HARM_SEVERITY_LOW = 'HARM_SEVERITY_LOW', - // Medium level of harm severity. + /** + * Medium level of harm severity. + */ HARM_SEVERITY_MEDIUM = 'HARM_SEVERITY_MEDIUM', - // High level of harm severity. + /** + * High level of harm severity. + */ HARM_SEVERITY_HIGH = 'HARM_SEVERITY_HIGH' } @@ -98,9 +126,13 @@ export enum HarmSeverity { * @public */ export enum BlockReason { - // Content was blocked by safety settings. + /** + * Content was blocked by safety settings. + */ SAFETY = 'SAFETY', - // Content was blocked, but the reason is uncategorized. + /** + * Content was blocked, but the reason is uncategorized. + */ OTHER = 'OTHER' } @@ -109,15 +141,25 @@ export enum BlockReason { * @public */ export enum FinishReason { - // Natural stop point of the model or provided stop sequence. + /** + * Natural stop point of the model or provided stop sequence. + */ STOP = 'STOP', - // The maximum number of tokens as specified in the request was reached. + /** + * The maximum number of tokens as specified in the request was reached. + */ MAX_TOKENS = 'MAX_TOKENS', - // The candidate content was flagged for safety reasons. + /** + * The candidate content was flagged for safety reasons. + */ SAFETY = 'SAFETY', - // The candidate content was flagged for recitation reasons. + /** + * The candidate content was flagged for recitation reasons. + */ RECITATION = 'RECITATION', - // Unknown reason. + /** + * Unknown reason. + */ OTHER = 'OTHER' } @@ -125,15 +167,21 @@ export enum FinishReason { * @public */ export enum FunctionCallingMode { - // Default model behavior, model decides to predict either a function call - // or a natural language response. + /** + * Default model behavior, model decides to predict either a function call + * or a natural language response. + */ AUTO = 'AUTO', - // Model is constrained to always predicting a function call only. - // If "allowed_function_names" is set, the predicted function call will be - // limited to any one of "allowed_function_names", else the predicted - // function call will be any one of the provided "function_declarations". + /** + * Model is constrained to always predicting a function call only. + * If "allowed_function_names" is set, the predicted function call will be + * limited to any one of "allowed_function_names", else the predicted + * function call will be any one of the provided "function_declarations". + */ ANY = 'ANY', - // Model will not predict any function call. Model behavior is same as when - // not passing any function declarations. + /** + * Model will not predict any function call. Model behavior is same as when + * not passing any function declarations. + */ NONE = 'NONE' } From faec0e7cf2d307cb85c20ec5d3bd72861f03242a Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 31 Jan 2025 10:35:51 -0500 Subject: [PATCH 2/3] Add code tags --- docs-devsite/vertexai.md | 4 ++-- packages/vertexai/src/types/enums.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index 6c25e46f2c1..c8e5684b17b 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -267,8 +267,8 @@ export declare enum FunctionCallingMode | Member | Value | Description | | --- | --- | --- | -| ANY | "ANY" | Model is constrained to always predicting a function call only. If "allowed\_function\_names" is set, the predicted function call will be limited to any one of "allowed\_function\_names", else the predicted function call will be any one of the provided "function\_declarations". | -| AUTO | "AUTO" | Default model behavior, model decides to predict either a function call or a natural language response. | +| ANY | "ANY" | Model is constrained to always predicting a function call only. If allowed_function_names is set, the predicted function call will be limited to any one of allowed_function_names, else the predicted function call will be any one of the provided function_declarations. | +| AUTO | "AUTO" | Default model behavior; model decides to predict either a function call or a natural language response. | | NONE | "NONE" | Model will not predict any function call. Model behavior is same as when not passing any function declarations. | ## HarmBlockMethod diff --git a/packages/vertexai/src/types/enums.ts b/packages/vertexai/src/types/enums.ts index b3d2a1b4fd7..c0d4c0b680b 100644 --- a/packages/vertexai/src/types/enums.ts +++ b/packages/vertexai/src/types/enums.ts @@ -168,15 +168,15 @@ export enum FinishReason { */ export enum FunctionCallingMode { /** - * Default model behavior, model decides to predict either a function call + * Default model behavior; model decides to predict either a function call * or a natural language response. */ AUTO = 'AUTO', /** * Model is constrained to always predicting a function call only. - * If "allowed_function_names" is set, the predicted function call will be - * limited to any one of "allowed_function_names", else the predicted - * function call will be any one of the provided "function_declarations". + * If `allowed_function_names` is set, the predicted function call will be + * limited to any one of `allowed_function_names`, else the predicted + * function call will be any one of the provided `function_declarations`. */ ANY = 'ANY', /** From 3f8cc3fc8143dcff65c17ba524975f7ae8adbd59 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 31 Jan 2025 10:44:48 -0500 Subject: [PATCH 3/3] Add more code tags --- docs-devsite/vertexai.md | 6 +++--- packages/vertexai/src/types/enums.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index c8e5684b17b..8c5c42bc42a 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -301,10 +301,10 @@ export declare enum HarmBlockThreshold | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "BLOCK_LOW_AND_ABOVE" | Content with NEGLIGIBLE will be allowed. | -| BLOCK\_MEDIUM\_AND\_ABOVE | "BLOCK_MEDIUM_AND_ABOVE" | Content with NEGLIGIBLE and LOW will be allowed. | +| BLOCK\_LOW\_AND\_ABOVE | "BLOCK_LOW_AND_ABOVE" | Content with NEGLIGIBLE will be allowed. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "BLOCK_MEDIUM_AND_ABOVE" | Content with NEGLIGIBLE and LOW will be allowed. | | BLOCK\_NONE | "BLOCK_NONE" | All content will be allowed. | -| BLOCK\_ONLY\_HIGH | "BLOCK_ONLY_HIGH" | Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. | +| BLOCK\_ONLY\_HIGH | "BLOCK_ONLY_HIGH" | Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. | ## HarmCategory diff --git a/packages/vertexai/src/types/enums.ts b/packages/vertexai/src/types/enums.ts index c0d4c0b680b..91d45b2cb48 100644 --- a/packages/vertexai/src/types/enums.ts +++ b/packages/vertexai/src/types/enums.ts @@ -44,15 +44,15 @@ export enum HarmCategory { */ export enum HarmBlockThreshold { /** - * Content with NEGLIGIBLE will be allowed. + * Content with `NEGLIGIBLE` will be allowed. */ BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE', /** - * Content with NEGLIGIBLE and LOW will be allowed. + * Content with `NEGLIGIBLE` and `LOW` will be allowed. */ BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE', /** - * Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. + * Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed. */ BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH', /**