-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add JSON Schema Support * Add unit tests * Add changeset * update changeset * Add some unit test cases (#159) --------- Co-authored-by: Christina Holland <[email protected]>
- Loading branch information
1 parent
bb7e6c9
commit 85ff2c4
Showing
23 changed files
with
261 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@google/generative-ai": minor | ||
--- | ||
|
||
Added `responseSchema` to `GenerationConfig` to allow user to provide a JSON schema when `responseMimeType` is set to JSON. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
docs/reference/main/generative-ai.functiondeclarationschemaproperty.description.md
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
docs/reference/main/generative-ai.functiondeclarationschemaproperty.example.md
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
docs/reference/main/generative-ai.functiondeclarationschemaproperty.format.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
docs/reference/main/generative-ai.functiondeclarationschemaproperty.required.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.generationconfig.responseschema.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GenerationConfig](./generative-ai.generationconfig.md) > [responseSchema](./generative-ai.generationconfig.responseschema.md) | ||
|
||
## GenerationConfig.responseSchema property | ||
|
||
Output response schema of the generated candidate text. Note: This only applies when the specified `responseMIMEType` supports a schema; currently this is limited to `application/json`<!-- -->. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
responseSchema?: ResponseSchema; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [ResponseSchema](./generative-ai.responseschema.md) | ||
|
||
## ResponseSchema interface | ||
|
||
Schema passed to [GenerationConfig.responseSchema](./generative-ai.generationconfig.responseschema.md) | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export interface ResponseSchema extends Schema | ||
``` | ||
**Extends:** [Schema](./generative-ai.schema.md) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [Schema](./generative-ai.schema.md) > [description](./generative-ai.schema.description.md) | ||
|
||
## Schema.description property | ||
|
||
Optional. The description of the property. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
description?: string; | ||
``` |
4 changes: 2 additions & 2 deletions
4
...functiondeclarationschemaproperty.enum.md → ...ference/main/generative-ai.schema.enum.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [Schema](./generative-ai.schema.md) > [example](./generative-ai.schema.example.md) | ||
|
||
## Schema.example property | ||
|
||
Optional. The example of the property. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
example?: unknown; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [Schema](./generative-ai.schema.md) > [format](./generative-ai.schema.format.md) | ||
|
||
## Schema.format property | ||
|
||
Optional. The format of the property. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
format?: string; | ||
``` |
4 changes: 2 additions & 2 deletions
4
...unctiondeclarationschemaproperty.items.md → ...erence/main/generative-ai.schema.items.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [Schema](./generative-ai.schema.md) | ||
|
||
## Schema interface | ||
|
||
Schema is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export interface Schema | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [description?](./generative-ai.schema.description.md) | | string | _(Optional)_ Optional. The description of the property. | | ||
| [enum?](./generative-ai.schema.enum.md) | | string\[\] | _(Optional)_ Optional. The enum of the property. | | ||
| [example?](./generative-ai.schema.example.md) | | unknown | _(Optional)_ Optional. The example of the property. | | ||
| [format?](./generative-ai.schema.format.md) | | string | _(Optional)_ Optional. The format of the property. | | ||
| [items?](./generative-ai.schema.items.md) | | [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | _(Optional)_ Optional. The items of the property. [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | | ||
| [nullable?](./generative-ai.schema.nullable.md) | | boolean | _(Optional)_ Optional. Whether the property is nullable. | | ||
| [properties?](./generative-ai.schema.properties.md) | | { \[k: string\]: [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)<!-- -->; } | _(Optional)_ Optional. Map of [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)<!-- -->. | | ||
| [required?](./generative-ai.schema.required.md) | | string\[\] | _(Optional)_ Optional. Array of required property. | | ||
| [type?](./generative-ai.schema.type.md) | | [FunctionDeclarationSchemaType](./generative-ai.functiondeclarationschematype.md) | _(Optional)_ Optional. The type of the property. [FunctionDeclarationSchemaType](./generative-ai.functiondeclarationschematype.md)<!-- -->. | | ||
|
4 changes: 2 additions & 2 deletions
4
...tiondeclarationschemaproperty.nullable.md → ...nce/main/generative-ai.schema.nullable.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ondeclarationschemaproperty.properties.md → ...e/main/generative-ai.schema.properties.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [Schema](./generative-ai.schema.md) > [required](./generative-ai.schema.required.md) | ||
|
||
## Schema.required property | ||
|
||
Optional. Array of required property. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
required?: string[]; | ||
``` |
4 changes: 2 additions & 2 deletions
4
...functiondeclarationschemaproperty.type.md → ...ference/main/generative-ai.schema.type.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.