Skip to content

Commit 9e5636a

Browse files
committed
feat(ai): Schema title, maximum, minimum, and propertyOrdering
1 parent 799de59 commit 9e5636a

File tree

5 files changed

+264
-178
lines changed

5 files changed

+264
-178
lines changed

.changeset/tricky-years-pump.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'firebase': minor
3+
'@firebase/ai': minor
4+
---
5+
6+
Add `title`, `maximum`, `minimum`, `propertyOrdering` to Schema builder

common/api-review/ai.api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,14 @@ export interface SchemaShared<T> {
831831
example?: unknown;
832832
format?: string;
833833
items?: T;
834+
maximum?: number;
835+
minimum?: number;
834836
nullable?: boolean;
835837
properties?: {
836838
[k: string]: T;
837839
};
840+
propertyOrdering?: string[];
841+
title?: string;
838842
}
839843

840844
// @public

docs-devsite/ai.schemashared.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ export interface SchemaShared<T>
2727
| [example](./ai.schemashared.md#schemasharedexample) | unknown | Optional. The example of the property. |
2828
| [format](./ai.schemashared.md#schemasharedformat) | string | Optional. The format of the property. When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this must be either <code>'enum'</code> or <code>'date-time'</code>, otherwise requests will fail. |
2929
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
30+
| [maximum](./ai.schemashared.md#schemasharedmaximum) | number | The maximum value of a numeric type. |
31+
| [minimum](./ai.schemashared.md#schemasharedminimum) | number | The minimum value of a numeric type. |
3032
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
3133
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
34+
| [propertyOrdering](./ai.schemashared.md#schemasharedpropertyordering) | string\[\] | A hint to the gemini model, suggesting the order in which the keys should appear in the generated JSON string. |
35+
| [title](./ai.schemashared.md#schemasharedtitle) | string | The title of the property. This helps document the schema's purpose but does not typically constrain the generated value. It can subtly guide the model by clarifying the intent of a field. |
3236

3337
## SchemaShared.description
3438

@@ -80,6 +84,26 @@ Optional. The items of the property.
8084
items?: T;
8185
```
8286

87+
## SchemaShared.maximum
88+
89+
The maximum value of a numeric type.
90+
91+
<b>Signature:</b>
92+
93+
```typescript
94+
maximum?: number;
95+
```
96+
97+
## SchemaShared.minimum
98+
99+
The minimum value of a numeric type.
100+
101+
<b>Signature:</b>
102+
103+
```typescript
104+
minimum?: number;
105+
```
106+
83107
## SchemaShared.nullable
84108

85109
Optional. Whether the property is nullable.
@@ -101,3 +125,23 @@ properties?: {
101125
[k: string]: T;
102126
};
103127
```
128+
129+
## SchemaShared.propertyOrdering
130+
131+
A hint to the gemini model, suggesting the order in which the keys should appear in the generated JSON string.
132+
133+
<b>Signature:</b>
134+
135+
```typescript
136+
propertyOrdering?: string[];
137+
```
138+
139+
## SchemaShared.title
140+
141+
The title of the property. This helps document the schema's purpose but does not typically constrain the generated value. It can subtly guide the model by clarifying the intent of a field.
142+
143+
<b>Signature:</b>
144+
145+
```typescript
146+
title?: string;
147+
```

0 commit comments

Comments
 (0)