diff --git a/.changeset/rotten-taxis-allow.md b/.changeset/rotten-taxis-allow.md
new file mode 100644
index 00000000000..0f009dbd8fe
--- /dev/null
+++ b/.changeset/rotten-taxis-allow.md
@@ -0,0 +1,5 @@
+---
+'@firebase/vertexai': patch
+---
+
+Fix typings for functionDeclaration.parameters.
diff --git a/common/api-review/vertexai.api.md b/common/api-review/vertexai.api.md
index e7f00c2f4e0..06e263ce944 100644
--- a/common/api-review/vertexai.api.md
+++ b/common/api-review/vertexai.api.md
@@ -211,7 +211,7 @@ export interface FunctionCallPart {
export interface FunctionDeclaration {
description: string;
name: string;
- parameters?: ObjectSchemaInterface;
+ parameters?: ObjectSchema | ObjectSchemaRequest;
}
// @public
@@ -567,9 +567,8 @@ export class ObjectSchema extends Schema {
}
// @public
-export interface ObjectSchemaInterface extends SchemaInterface {
- // (undocumented)
- optionalProperties?: string[];
+export interface ObjectSchemaRequest extends SchemaRequest {
+ optionalProperties?: never;
// (undocumented)
type: SchemaType.OBJECT;
}
diff --git a/docs-devsite/_toc.yaml b/docs-devsite/_toc.yaml
index 665222edb9d..f52f32e223e 100644
--- a/docs-devsite/_toc.yaml
+++ b/docs-devsite/_toc.yaml
@@ -564,8 +564,8 @@ toc:
path: /docs/reference/js/vertexai.numberschema.md
- title: ObjectSchema
path: /docs/reference/js/vertexai.objectschema.md
- - title: ObjectSchemaInterface
- path: /docs/reference/js/vertexai.objectschemainterface.md
+ - title: ObjectSchemaRequest
+ path: /docs/reference/js/vertexai.objectschemarequest.md
- title: PromptFeedback
path: /docs/reference/js/vertexai.promptfeedback.md
- title: RequestOptions
diff --git a/docs-devsite/vertexai.functiondeclaration.md b/docs-devsite/vertexai.functiondeclaration.md
index 211c1dd868d..5a0b5f0d7ae 100644
--- a/docs-devsite/vertexai.functiondeclaration.md
+++ b/docs-devsite/vertexai.functiondeclaration.md
@@ -24,7 +24,7 @@ export declare interface FunctionDeclaration
| --- | --- | --- |
| [description](./vertexai.functiondeclaration.md#functiondeclarationdescription) | string | Description and purpose of the function. Model uses it to decide how and whether to call the function. |
| [name](./vertexai.functiondeclaration.md#functiondeclarationname) | string | The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a max length of 64. |
-| [parameters](./vertexai.functiondeclaration.md#functiondeclarationparameters) | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. Parameter names are case-sensitive. For a function with no parameters, this can be left unset. |
+| [parameters](./vertexai.functiondeclaration.md#functiondeclarationparameters) | [ObjectSchema](./vertexai.objectschema.md#objectschema_class) \| [ObjectSchemaRequest](./vertexai.objectschemarequest.md#objectschemarequest_interface) | Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. Parameter names are case-sensitive. For a function with no parameters, this can be left unset. |
## FunctionDeclaration.description
@@ -53,5 +53,5 @@ Optional. Describes the parameters to this function in JSON Schema Object format
Signature:
```typescript
-parameters?: ObjectSchemaInterface;
+parameters?: ObjectSchema | ObjectSchemaRequest;
```
diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md
index f67254eef20..261a78a6772 100644
--- a/docs-devsite/vertexai.md
+++ b/docs-devsite/vertexai.md
@@ -100,7 +100,7 @@ The Vertex AI in Firebase Web SDK.
| [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. |
| [ModalityTokenCount](./vertexai.modalitytokencount.md#modalitytokencount_interface) | Represents token counting info for a single modality. |
| [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). |
-| [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. |
+| [ObjectSchemaRequest](./vertexai.objectschemarequest.md#objectschemarequest_interface) | Interface for JSON parameters in [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) format when not using the [ObjectSchema](./vertexai.objectschema.md#objectschema_class) helper. |
| [PromptFeedback](./vertexai.promptfeedback.md#promptfeedback_interface) | If the prompt was blocked, this will be populated with blockReason
and the relevant safetyRatings
. |
| [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). |
| [RetrievedContextAttribution](./vertexai.retrievedcontextattribution.md#retrievedcontextattribution_interface) | |
diff --git a/docs-devsite/vertexai.objectschemainterface.md b/docs-devsite/vertexai.objectschemainterface.md
deleted file mode 100644
index 4eb7a5d80e7..00000000000
--- a/docs-devsite/vertexai.objectschemainterface.md
+++ /dev/null
@@ -1,43 +0,0 @@
-Project: /docs/reference/js/_project.yaml
-Book: /docs/reference/_book.yaml
-page_type: reference
-
-{% comment %}
-DO NOT EDIT THIS FILE!
-This is generated by the JS SDK team, and any local changes will be
-overwritten. Changes should be made in the source code at
-https://github.com/firebase/firebase-js-sdk
-{% endcomment %}
-
-# ObjectSchemaInterface interface
-Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class.
-
-Signature:
-
-```typescript
-export interface ObjectSchemaInterface extends SchemaInterface
-```
-Extends: [SchemaInterface](./vertexai.schemainterface.md#schemainterface_interface)
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [optionalProperties](./vertexai.objectschemainterface.md#objectschemainterfaceoptionalproperties) | string\[\] | |
-| [type](./vertexai.objectschemainterface.md#objectschemainterfacetype) | [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) | |
-
-## ObjectSchemaInterface.optionalProperties
-
-Signature:
-
-```typescript
-optionalProperties?: string[];
-```
-
-## ObjectSchemaInterface.type
-
-Signature:
-
-```typescript
-type: SchemaType.OBJECT;
-```
diff --git a/docs-devsite/vertexai.objectschemarequest.md b/docs-devsite/vertexai.objectschemarequest.md
new file mode 100644
index 00000000000..f804ff822c0
--- /dev/null
+++ b/docs-devsite/vertexai.objectschemarequest.md
@@ -0,0 +1,45 @@
+Project: /docs/reference/js/_project.yaml
+Book: /docs/reference/_book.yaml
+page_type: reference
+
+{% comment %}
+DO NOT EDIT THIS FILE!
+This is generated by the JS SDK team, and any local changes will be
+overwritten. Changes should be made in the source code at
+https://github.com/firebase/firebase-js-sdk
+{% endcomment %}
+
+# ObjectSchemaRequest interface
+Interface for JSON parameters in [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) format when not using the [ObjectSchema](./vertexai.objectschema.md#objectschema_class) helper.
+
+Signature:
+
+```typescript
+export interface ObjectSchemaRequest extends SchemaRequest
+```
+Extends: [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface)
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [optionalProperties](./vertexai.objectschemarequest.md#objectschemarequestoptionalproperties) | never | This is not a property accepted in the final request to the backend, but is a client-side convenience property that is only usable by constructing a schema through the Schema.object()
helper method. |
+| [type](./vertexai.objectschemarequest.md#objectschemarequesttype) | [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) | |
+
+## ObjectSchemaRequest.optionalProperties
+
+This is not a property accepted in the final request to the backend, but is a client-side convenience property that is only usable by constructing a schema through the `Schema.object()` helper method.
+
+Signature:
+
+```typescript
+optionalProperties?: never;
+```
+
+## ObjectSchemaRequest.type
+
+Signature:
+
+```typescript
+type: SchemaType.OBJECT;
+```
diff --git a/packages/vertexai/src/requests/schema-builder.ts b/packages/vertexai/src/requests/schema-builder.ts
index 3d219d58b13..9da70738332 100644
--- a/packages/vertexai/src/requests/schema-builder.ts
+++ b/packages/vertexai/src/requests/schema-builder.ts
@@ -21,8 +21,7 @@ import {
SchemaInterface,
SchemaType,
SchemaParams,
- SchemaRequest,
- ObjectSchemaInterface
+ SchemaRequest
} from '../types/schema';
/**
@@ -286,7 +285,7 @@ export class ObjectSchema extends Schema {
if (required.length > 0) {
obj.required = required;
}
- delete (obj as ObjectSchemaInterface).optionalProperties;
+ delete obj.optionalProperties;
return obj as SchemaRequest;
}
}
diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts
index c15258b06d0..45d10ba49c8 100644
--- a/packages/vertexai/src/types/requests.ts
+++ b/packages/vertexai/src/types/requests.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { TypedSchema } from '../requests/schema-builder';
+import { ObjectSchema, TypedSchema } from '../requests/schema-builder';
import { Content, Part } from './content';
import {
FunctionCallingMode,
@@ -23,7 +23,7 @@ import {
HarmBlockThreshold,
HarmCategory
} from './enums';
-import { ObjectSchemaInterface, SchemaRequest } from './schema';
+import { ObjectSchemaRequest, SchemaRequest } from './schema';
/**
* Base parameters for a number of methods.
@@ -175,7 +175,7 @@ export declare interface FunctionDeclaration {
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
* case-sensitive. For a function with no parameters, this can be left unset.
*/
- parameters?: ObjectSchemaInterface;
+ parameters?: ObjectSchema | ObjectSchemaRequest;
}
/**
diff --git a/packages/vertexai/src/types/schema.ts b/packages/vertexai/src/types/schema.ts
index 5c23655be0e..74ae174d1dc 100644
--- a/packages/vertexai/src/types/schema.ts
+++ b/packages/vertexai/src/types/schema.ts
@@ -95,10 +95,16 @@ export interface SchemaInterface extends SchemaShared {
}
/**
- * Interface for {@link ObjectSchema} class.
+ * Interface for JSON parameters in {@link SchemaType.OBJECT} format when
+ * not using the {@link ObjectSchema} helper.
* @public
*/
-export interface ObjectSchemaInterface extends SchemaInterface {
+export interface ObjectSchemaRequest extends SchemaRequest {
type: SchemaType.OBJECT;
- optionalProperties?: string[];
+ /**
+ * This is not a property accepted in the final request to the backend, but is
+ * a client-side convenience property that is only usable by constructing
+ * a schema through the `Schema.object()` helper method.
+ */
+ optionalProperties?: never;
}