Skip to content

feat(ai): Schema title, maximum, minimum, and propertyOrdering #9047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/tricky-years-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'firebase': minor
'@firebase/ai': minor
---

Add `title`, `maximum`, `minimum`, `propertyOrdering` to Schema builder
4 changes: 4 additions & 0 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,14 @@ export interface SchemaShared<T> {
example?: unknown;
format?: string;
items?: T;
maximum?: number;
minimum?: number;
nullable?: boolean;
properties?: {
[k: string]: T;
};
propertyOrdering?: string[];
title?: string;
}

// @public
Expand Down
44 changes: 44 additions & 0 deletions docs-devsite/ai.schemashared.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ export interface SchemaShared<T>
| [example](./ai.schemashared.md#schemasharedexample) | unknown | Optional. The example of the property. |
| [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. |
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
| [maximum](./ai.schemashared.md#schemasharedmaximum) | number | The maximum value of a numeric type. |
| [minimum](./ai.schemashared.md#schemasharedminimum) | number | The minimum value of a numeric type. |
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
| [propertyOrdering](./ai.schemashared.md#schemasharedpropertyordering) | string\[\] | A hint suggesting the order in which the keys should appear in the generated JSON string. |
| [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. |

## SchemaShared.description

Expand Down Expand Up @@ -80,6 +84,26 @@ Optional. The items of the property.
items?: T;
```

## SchemaShared.maximum

The maximum value of a numeric type.

<b>Signature:</b>

```typescript
maximum?: number;
```

## SchemaShared.minimum

The minimum value of a numeric type.

<b>Signature:</b>

```typescript
minimum?: number;
```

## SchemaShared.nullable

Optional. Whether the property is nullable.
Expand All @@ -101,3 +125,23 @@ properties?: {
[k: string]: T;
};
```

## SchemaShared.propertyOrdering

A hint suggesting the order in which the keys should appear in the generated JSON string.

<b>Signature:</b>

```typescript
propertyOrdering?: string[];
```

## SchemaShared.title

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.

<b>Signature:</b>

```typescript
title?: string;
```
Loading
Loading