Skip to content

Commit 246ee9f

Browse files
authored
Merge 24d05ab into 1363ecc
2 parents 1363ecc + 24d05ab commit 246ee9f

File tree

10 files changed

+72
-61
lines changed

10 files changed

+72
-61
lines changed

.changeset/rotten-taxis-allow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/vertexai': patch
3+
---
4+
5+
Fix typings for functionDeclaration.parameters.

common/api-review/vertexai.api.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export interface FunctionCallPart {
211211
export interface FunctionDeclaration {
212212
description: string;
213213
name: string;
214-
parameters?: ObjectSchemaInterface;
214+
parameters?: ObjectSchema | ObjectSchemaRequest;
215215
}
216216

217217
// @public
@@ -567,9 +567,8 @@ export class ObjectSchema extends Schema {
567567
}
568568

569569
// @public
570-
export interface ObjectSchemaInterface extends SchemaInterface {
571-
// (undocumented)
572-
optionalProperties?: string[];
570+
export interface ObjectSchemaRequest extends SchemaRequest {
571+
optionalProperties?: never;
573572
// (undocumented)
574573
type: SchemaType.OBJECT;
575574
}

docs-devsite/_toc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ toc:
564564
path: /docs/reference/js/vertexai.numberschema.md
565565
- title: ObjectSchema
566566
path: /docs/reference/js/vertexai.objectschema.md
567-
- title: ObjectSchemaInterface
568-
path: /docs/reference/js/vertexai.objectschemainterface.md
567+
- title: ObjectSchemaRequest
568+
path: /docs/reference/js/vertexai.objectschemarequest.md
569569
- title: PromptFeedback
570570
path: /docs/reference/js/vertexai.promptfeedback.md
571571
- title: RequestOptions

docs-devsite/vertexai.functiondeclaration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export declare interface FunctionDeclaration
2424
| --- | --- | --- |
2525
| [description](./vertexai.functiondeclaration.md#functiondeclarationdescription) | string | Description and purpose of the function. Model uses it to decide how and whether to call the function. |
2626
| [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. |
27-
| [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. |
27+
| [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. |
2828

2929
## FunctionDeclaration.description
3030

@@ -53,5 +53,5 @@ Optional. Describes the parameters to this function in JSON Schema Object format
5353
<b>Signature:</b>
5454

5555
```typescript
56-
parameters?: ObjectSchemaInterface;
56+
parameters?: ObjectSchema | ObjectSchemaRequest;
5757
```

docs-devsite/vertexai.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The Vertex AI in Firebase Web SDK.
100100
| [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. |
101101
| [ModalityTokenCount](./vertexai.modalitytokencount.md#modalitytokencount_interface) | Represents token counting info for a single modality. |
102102
| [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9)<!-- -->. |
103-
| [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. |
103+
| [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. |
104104
| [PromptFeedback](./vertexai.promptfeedback.md#promptfeedback_interface) | If the prompt was blocked, this will be populated with <code>blockReason</code> and the relevant <code>safetyRatings</code>. |
105105
| [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9)<!-- -->. |
106106
| [RetrievedContextAttribution](./vertexai.retrievedcontextattribution.md#retrievedcontextattribution_interface) | |

docs-devsite/vertexai.objectschemainterface.md

-43
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# ObjectSchemaRequest interface
13+
Interface for JSON parameters in [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) format when not using the [ObjectSchema](./vertexai.objectschema.md#objectschema_class) helper.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface ObjectSchemaRequest extends SchemaRequest
19+
```
20+
<b>Extends:</b> [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface)
21+
22+
## Properties
23+
24+
| Property | Type | Description |
25+
| --- | --- | --- |
26+
| [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 <code>Schema.object()</code> helper method. |
27+
| [type](./vertexai.objectschemarequest.md#objectschemarequesttype) | [SchemaType.OBJECT](./vertexai.md#schematypeobject_enummember) | |
28+
29+
## ObjectSchemaRequest.optionalProperties
30+
31+
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.
32+
33+
<b>Signature:</b>
34+
35+
```typescript
36+
optionalProperties?: never;
37+
```
38+
39+
## ObjectSchemaRequest.type
40+
41+
<b>Signature:</b>
42+
43+
```typescript
44+
type: SchemaType.OBJECT;
45+
```

packages/vertexai/src/requests/schema-builder.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import {
2121
SchemaInterface,
2222
SchemaType,
2323
SchemaParams,
24-
SchemaRequest,
25-
ObjectSchemaInterface
24+
SchemaRequest
2625
} from '../types/schema';
2726

2827
/**
@@ -286,7 +285,7 @@ export class ObjectSchema extends Schema {
286285
if (required.length > 0) {
287286
obj.required = required;
288287
}
289-
delete (obj as ObjectSchemaInterface).optionalProperties;
288+
delete obj.optionalProperties;
290289
return obj as SchemaRequest;
291290
}
292291
}

packages/vertexai/src/types/requests.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { TypedSchema } from '../requests/schema-builder';
18+
import { ObjectSchema, TypedSchema } from '../requests/schema-builder';
1919
import { Content, Part } from './content';
2020
import {
2121
FunctionCallingMode,
2222
HarmBlockMethod,
2323
HarmBlockThreshold,
2424
HarmCategory
2525
} from './enums';
26-
import { ObjectSchemaInterface, SchemaRequest } from './schema';
26+
import { ObjectSchemaRequest, SchemaRequest } from './schema';
2727

2828
/**
2929
* Base parameters for a number of methods.
@@ -175,7 +175,7 @@ export declare interface FunctionDeclaration {
175175
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
176176
* case-sensitive. For a function with no parameters, this can be left unset.
177177
*/
178-
parameters?: ObjectSchemaInterface;
178+
parameters?: ObjectSchema | ObjectSchemaRequest;
179179
}
180180

181181
/**

packages/vertexai/src/types/schema.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,16 @@ export interface SchemaInterface extends SchemaShared<SchemaInterface> {
9595
}
9696

9797
/**
98-
* Interface for {@link ObjectSchema} class.
98+
* Interface for JSON parameters in {@link SchemaType.OBJECT} format when
99+
* not using the {@link ObjectSchema} helper.
99100
* @public
100101
*/
101-
export interface ObjectSchemaInterface extends SchemaInterface {
102+
export interface ObjectSchemaRequest extends SchemaRequest {
102103
type: SchemaType.OBJECT;
103-
optionalProperties?: string[];
104+
/**
105+
* This is not a property accepted in the final request to the backend, but is
106+
* a client-side convenience property that is only usable by constructing
107+
* a schema through the `Schema.object()` helper method.
108+
*/
109+
optionalProperties?: never;
104110
}

0 commit comments

Comments
 (0)