From fb2b98ee8936bc6163119d175d38a9ac10572483 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 3 May 2024 12:57:18 -0400 Subject: [PATCH 1/2] Add generated docs --- .../generative-ai.requestoptions.customheaders.md | 13 +++++++++++++ .../reference/files/generative-ai.requestoptions.md | 1 + ...rative-ai.googlegenerativeairequestinputerror.md | 13 +++++++++++++ docs/reference/main/generative-ai.md | 1 + .../generative-ai.requestoptions.customheaders.md | 13 +++++++++++++ docs/reference/main/generative-ai.requestoptions.md | 1 + 6 files changed, 42 insertions(+) create mode 100644 docs/reference/files/generative-ai.requestoptions.customheaders.md create mode 100644 docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md create mode 100644 docs/reference/main/generative-ai.requestoptions.customheaders.md diff --git a/docs/reference/files/generative-ai.requestoptions.customheaders.md b/docs/reference/files/generative-ai.requestoptions.customheaders.md new file mode 100644 index 00000000..e02ae8a9 --- /dev/null +++ b/docs/reference/files/generative-ai.requestoptions.customheaders.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [RequestOptions](./generative-ai.requestoptions.md) > [customHeaders](./generative-ai.requestoptions.customheaders.md) + +## RequestOptions.customHeaders property + +Custom HTTP request headers. + +**Signature:** + +```typescript +customHeaders?: Headers | Record; +``` diff --git a/docs/reference/files/generative-ai.requestoptions.md b/docs/reference/files/generative-ai.requestoptions.md index 7809e3a0..44aba7de 100644 --- a/docs/reference/files/generative-ai.requestoptions.md +++ b/docs/reference/files/generative-ai.requestoptions.md @@ -19,5 +19,6 @@ export interface RequestOptions | [apiClient?](./generative-ai.requestoptions.apiclient.md) | | string | _(Optional)_ Additional attribution information to include in the x-goog-api-client header. Used by wrapper SDKs. | | [apiVersion?](./generative-ai.requestoptions.apiversion.md) | | string | _(Optional)_ Version of API endpoint to call (e.g. "v1" or "v1beta"). If not specified, defaults to latest stable version. | | [baseUrl?](./generative-ai.requestoptions.baseurl.md) | | string | _(Optional)_ Base endpoint url. Defaults to "https://generativelanguage.googleapis.com" | +| [customHeaders?](./generative-ai.requestoptions.customheaders.md) | | Headers \| Record<string, string> | _(Optional)_ Custom HTTP request headers. | | [timeout?](./generative-ai.requestoptions.timeout.md) | | number | _(Optional)_ Request timeout in milliseconds. | diff --git a/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md b/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md new file mode 100644 index 00000000..a609cff0 --- /dev/null +++ b/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GoogleGenerativeAIRequestInputError](./generative-ai.googlegenerativeairequestinputerror.md) + +## GoogleGenerativeAIRequestInputError class + +**Signature:** + +```typescript +export declare class GoogleGenerativeAIRequestInputError extends GoogleGenerativeAIError +``` +**Extends:** [GoogleGenerativeAIError](./generative-ai.googlegenerativeaierror.md) + diff --git a/docs/reference/main/generative-ai.md b/docs/reference/main/generative-ai.md index 2a31e0f2..848d55fd 100644 --- a/docs/reference/main/generative-ai.md +++ b/docs/reference/main/generative-ai.md @@ -13,6 +13,7 @@ | [GoogleGenerativeAI](./generative-ai.googlegenerativeai.md) | Top-level class for this SDK | | [GoogleGenerativeAIError](./generative-ai.googlegenerativeaierror.md) | Basic error type for this SDK. | | [GoogleGenerativeAIFetchError](./generative-ai.googlegenerativeaifetcherror.md) | Error class covering HTTP errors when calling the server. Includes HTTP status, statusText, and optional details, if provided in the server response. | +| [GoogleGenerativeAIRequestInputError](./generative-ai.googlegenerativeairequestinputerror.md) | | | [GoogleGenerativeAIResponseError](./generative-ai.googlegenerativeairesponseerror.md) | Errors in the contents of a response from the model. This includes parsing errors, or responses including a safety block reason. | ## Enumerations diff --git a/docs/reference/main/generative-ai.requestoptions.customheaders.md b/docs/reference/main/generative-ai.requestoptions.customheaders.md new file mode 100644 index 00000000..e02ae8a9 --- /dev/null +++ b/docs/reference/main/generative-ai.requestoptions.customheaders.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [RequestOptions](./generative-ai.requestoptions.md) > [customHeaders](./generative-ai.requestoptions.customheaders.md) + +## RequestOptions.customHeaders property + +Custom HTTP request headers. + +**Signature:** + +```typescript +customHeaders?: Headers | Record; +``` diff --git a/docs/reference/main/generative-ai.requestoptions.md b/docs/reference/main/generative-ai.requestoptions.md index 7809e3a0..44aba7de 100644 --- a/docs/reference/main/generative-ai.requestoptions.md +++ b/docs/reference/main/generative-ai.requestoptions.md @@ -19,5 +19,6 @@ export interface RequestOptions | [apiClient?](./generative-ai.requestoptions.apiclient.md) | | string | _(Optional)_ Additional attribution information to include in the x-goog-api-client header. Used by wrapper SDKs. | | [apiVersion?](./generative-ai.requestoptions.apiversion.md) | | string | _(Optional)_ Version of API endpoint to call (e.g. "v1" or "v1beta"). If not specified, defaults to latest stable version. | | [baseUrl?](./generative-ai.requestoptions.baseurl.md) | | string | _(Optional)_ Base endpoint url. Defaults to "https://generativelanguage.googleapis.com" | +| [customHeaders?](./generative-ai.requestoptions.customheaders.md) | | Headers \| Record<string, string> | _(Optional)_ Custom HTTP request headers. | | [timeout?](./generative-ai.requestoptions.timeout.md) | | number | _(Optional)_ Request timeout in milliseconds. | From 7e9d62372b1e4b6872ee44900b685d68c917339e Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 3 May 2024 13:03:43 -0400 Subject: [PATCH 2/2] Mark new GenerativeAI errors as public --- .../main/generative-ai.googlegenerativeairequestinputerror.md | 2 ++ docs/reference/main/generative-ai.md | 2 +- packages/main/src/errors.ts | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md b/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md index a609cff0..d2a04839 100644 --- a/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md +++ b/docs/reference/main/generative-ai.googlegenerativeairequestinputerror.md @@ -4,6 +4,8 @@ ## GoogleGenerativeAIRequestInputError class +Errors in the contents of a request originating from user input. + **Signature:** ```typescript diff --git a/docs/reference/main/generative-ai.md b/docs/reference/main/generative-ai.md index 848d55fd..c515155a 100644 --- a/docs/reference/main/generative-ai.md +++ b/docs/reference/main/generative-ai.md @@ -13,7 +13,7 @@ | [GoogleGenerativeAI](./generative-ai.googlegenerativeai.md) | Top-level class for this SDK | | [GoogleGenerativeAIError](./generative-ai.googlegenerativeaierror.md) | Basic error type for this SDK. | | [GoogleGenerativeAIFetchError](./generative-ai.googlegenerativeaifetcherror.md) | Error class covering HTTP errors when calling the server. Includes HTTP status, statusText, and optional details, if provided in the server response. | -| [GoogleGenerativeAIRequestInputError](./generative-ai.googlegenerativeairequestinputerror.md) | | +| [GoogleGenerativeAIRequestInputError](./generative-ai.googlegenerativeairequestinputerror.md) | Errors in the contents of a request originating from user input. | | [GoogleGenerativeAIResponseError](./generative-ai.googlegenerativeairesponseerror.md) | Errors in the contents of a response from the model. This includes parsing errors, or responses including a safety block reason. | ## Enumerations diff --git a/packages/main/src/errors.ts b/packages/main/src/errors.ts index 95d50ba3..42514b44 100644 --- a/packages/main/src/errors.ts +++ b/packages/main/src/errors.ts @@ -44,6 +44,7 @@ export class GoogleGenerativeAIResponseError< /** * Error class covering HTTP errors when calling the server. Includes HTTP * status, statusText, and optional details, if provided in the server response. + * @public */ export class GoogleGenerativeAIFetchError extends GoogleGenerativeAIError { constructor( @@ -57,6 +58,8 @@ export class GoogleGenerativeAIFetchError extends GoogleGenerativeAIError { } /** + * Errors in the contents of a request originating from user input. + * @public */ export class GoogleGenerativeAIRequestInputError extends GoogleGenerativeAIError {}