diff --git a/.changeset/silver-cats-melt.md b/.changeset/silver-cats-melt.md
new file mode 100644
index 00000000..c9a651d4
--- /dev/null
+++ b/.changeset/silver-cats-melt.md
@@ -0,0 +1,5 @@
+---
+"@google/generative-ai": patch
+---
+
+Fix a schema type for response_schema and function calling
diff --git a/common/api-review/generative-ai-server.api.md b/common/api-review/generative-ai-server.api.md
index 99b4a03c..90b61ec3 100644
--- a/common/api-review/generative-ai-server.api.md
+++ b/common/api-review/generative-ai-server.api.md
@@ -267,21 +267,7 @@ export interface FunctionCallPart {
export interface FunctionDeclaration {
description?: string;
name: string;
- parameters?: FunctionDeclarationSchema;
-}
-
-// @public
-export interface FunctionDeclarationSchema {
- description?: string;
- properties: {
- [k: string]: FunctionDeclarationSchemaProperty;
- };
- required?: string[];
- type: FunctionDeclarationSchemaType;
-}
-
-// @public
-export interface FunctionDeclarationSchemaProperty extends Schema {
+ parameters?: Schema;
}
// @public
@@ -417,10 +403,6 @@ export interface RequestOptions {
timeout?: number;
}
-// @public
-export interface ResponseSchema extends Schema {
-}
-
// @public
export interface RpcStatus {
code: number;
@@ -434,10 +416,10 @@ export interface Schema {
enum?: string[];
example?: unknown;
format?: string;
- items?: FunctionDeclarationSchema;
+ items?: Schema;
nullable?: boolean;
properties?: {
- [k: string]: FunctionDeclarationSchema;
+ [k: string]: Schema;
};
required?: string[];
type?: FunctionDeclarationSchemaType;
diff --git a/common/api-review/generative-ai.api.md b/common/api-review/generative-ai.api.md
index efcd6ce2..20b578a3 100644
--- a/common/api-review/generative-ai.api.md
+++ b/common/api-review/generative-ai.api.md
@@ -319,21 +319,7 @@ export interface FunctionCallPart {
export interface FunctionDeclaration {
description?: string;
name: string;
- parameters?: FunctionDeclarationSchema;
-}
-
-// @public
-export interface FunctionDeclarationSchema {
- description?: string;
- properties: {
- [k: string]: FunctionDeclarationSchemaProperty;
- };
- required?: string[];
- type: FunctionDeclarationSchemaType;
-}
-
-// @public
-export interface FunctionDeclarationSchemaProperty extends Schema {
+ parameters?: Schema;
}
// @public
@@ -440,7 +426,7 @@ export interface GenerationConfig {
// (undocumented)
maxOutputTokens?: number;
responseMimeType?: string;
- responseSchema?: ResponseSchema;
+ responseSchema?: Schema;
// (undocumented)
stopSequences?: string[];
// (undocumented)
@@ -630,10 +616,6 @@ export interface RequestOptions {
timeout?: number;
}
-// @public
-export interface ResponseSchema extends Schema {
-}
-
// @public
export interface SafetyRating {
// (undocumented)
@@ -656,10 +638,10 @@ export interface Schema {
enum?: string[];
example?: unknown;
format?: string;
- items?: FunctionDeclarationSchema;
+ items?: Schema;
nullable?: boolean;
properties?: {
- [k: string]: FunctionDeclarationSchema;
+ [k: string]: Schema;
};
required?: string[];
type?: FunctionDeclarationSchemaType;
diff --git a/docs/reference/main/generative-ai.functiondeclaration.md b/docs/reference/main/generative-ai.functiondeclaration.md
index 1657ab4b..71ac272a 100644
--- a/docs/reference/main/generative-ai.functiondeclaration.md
+++ b/docs/reference/main/generative-ai.functiondeclaration.md
@@ -18,5 +18,5 @@ export declare interface FunctionDeclaration
| --- | --- | --- | --- |
| [description?](./generative-ai.functiondeclaration.description.md) | | string | _(Optional)_ Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. |
| [name](./generative-ai.functiondeclaration.name.md) | | 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?](./generative-ai.functiondeclaration.parameters.md) | | [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | _(Optional)_ Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. |
+| [parameters?](./generative-ai.functiondeclaration.parameters.md) | | [Schema](./generative-ai.schema.md) | _(Optional)_ Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. |
diff --git a/docs/reference/main/generative-ai.functiondeclaration.parameters.md b/docs/reference/main/generative-ai.functiondeclaration.parameters.md
index f6005c5b..0d26c7df 100644
--- a/docs/reference/main/generative-ai.functiondeclaration.parameters.md
+++ b/docs/reference/main/generative-ai.functiondeclaration.parameters.md
@@ -9,7 +9,7 @@ Optional. Describes the parameters to this function in JSON Schema Object format
**Signature:**
```typescript
-parameters?: FunctionDeclarationSchema;
+parameters?: Schema;
```
## Example
diff --git a/docs/reference/main/generative-ai.functiondeclarationschema.description.md b/docs/reference/main/generative-ai.functiondeclarationschema.description.md
deleted file mode 100644
index a8d37cec..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschema.description.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [description](./generative-ai.functiondeclarationschema.description.md)
-
-## FunctionDeclarationSchema.description property
-
-Optional. Description of the parameter.
-
-**Signature:**
-
-```typescript
-description?: string;
-```
diff --git a/docs/reference/main/generative-ai.functiondeclarationschema.md b/docs/reference/main/generative-ai.functiondeclarationschema.md
deleted file mode 100644
index 0af8377b..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschema.md
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)
-
-## FunctionDeclarationSchema interface
-
-Schema for parameters passed to [FunctionDeclaration.parameters](./generative-ai.functiondeclaration.parameters.md).
-
-**Signature:**
-
-```typescript
-export interface FunctionDeclarationSchema
-```
-
-## Properties
-
-| Property | Modifiers | Type | Description |
-| --- | --- | --- | --- |
-| [description?](./generative-ai.functiondeclarationschema.description.md) | | string | _(Optional)_ Optional. Description of the parameter. |
-| [properties](./generative-ai.functiondeclarationschema.properties.md) | | { \[k: string\]: [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md); } | The format of the parameter. |
-| [required?](./generative-ai.functiondeclarationschema.required.md) | | string\[\] | _(Optional)_ Optional. Array of required parameters. |
-| [type](./generative-ai.functiondeclarationschema.type.md) | | [FunctionDeclarationSchemaType](./generative-ai.functiondeclarationschematype.md) | The type of the parameter. |
-
diff --git a/docs/reference/main/generative-ai.functiondeclarationschema.properties.md b/docs/reference/main/generative-ai.functiondeclarationschema.properties.md
deleted file mode 100644
index b1642c49..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschema.properties.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [properties](./generative-ai.functiondeclarationschema.properties.md)
-
-## FunctionDeclarationSchema.properties property
-
-The format of the parameter.
-
-**Signature:**
-
-```typescript
-properties: {
- [k: string]: FunctionDeclarationSchemaProperty;
- };
-```
diff --git a/docs/reference/main/generative-ai.functiondeclarationschema.required.md b/docs/reference/main/generative-ai.functiondeclarationschema.required.md
deleted file mode 100644
index fdddab0b..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschema.required.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [required](./generative-ai.functiondeclarationschema.required.md)
-
-## FunctionDeclarationSchema.required property
-
-Optional. Array of required parameters.
-
-**Signature:**
-
-```typescript
-required?: string[];
-```
diff --git a/docs/reference/main/generative-ai.functiondeclarationschema.type.md b/docs/reference/main/generative-ai.functiondeclarationschema.type.md
deleted file mode 100644
index 7d336a82..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschema.type.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [type](./generative-ai.functiondeclarationschema.type.md)
-
-## FunctionDeclarationSchema.type property
-
-The type of the parameter.
-
-**Signature:**
-
-```typescript
-type: FunctionDeclarationSchemaType;
-```
diff --git a/docs/reference/main/generative-ai.functiondeclarationschemaproperty.md b/docs/reference/main/generative-ai.functiondeclarationschemaproperty.md
deleted file mode 100644
index b0303af1..00000000
--- a/docs/reference/main/generative-ai.functiondeclarationschemaproperty.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md)
-
-## FunctionDeclarationSchemaProperty interface
-
-Schema for top-level function declaration
-
-**Signature:**
-
-```typescript
-export interface FunctionDeclarationSchemaProperty extends Schema
-```
-**Extends:** [Schema](./generative-ai.schema.md)
-
diff --git a/docs/reference/main/generative-ai.generationconfig.md b/docs/reference/main/generative-ai.generationconfig.md
index c6e5fa18..14c635c3 100644
--- a/docs/reference/main/generative-ai.generationconfig.md
+++ b/docs/reference/main/generative-ai.generationconfig.md
@@ -19,7 +19,7 @@ export interface GenerationConfig
| [candidateCount?](./generative-ai.generationconfig.candidatecount.md) | | number | _(Optional)_ |
| [maxOutputTokens?](./generative-ai.generationconfig.maxoutputtokens.md) | | number | _(Optional)_ |
| [responseMimeType?](./generative-ai.generationconfig.responsemimetype.md) | | string | _(Optional)_ Output response mimetype of the generated candidate text. Supported mimetype: text/plain
: (default) Text output. application/json
: JSON response in the candidates. |
-| [responseSchema?](./generative-ai.generationconfig.responseschema.md) | | [ResponseSchema](./generative-ai.responseschema.md) | _(Optional)_ 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
. |
+| [responseSchema?](./generative-ai.generationconfig.responseschema.md) | | [Schema](./generative-ai.schema.md) | _(Optional)_ 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
. |
| [stopSequences?](./generative-ai.generationconfig.stopsequences.md) | | string\[\] | _(Optional)_ |
| [temperature?](./generative-ai.generationconfig.temperature.md) | | number | _(Optional)_ |
| [topK?](./generative-ai.generationconfig.topk.md) | | number | _(Optional)_ |
diff --git a/docs/reference/main/generative-ai.generationconfig.responseschema.md b/docs/reference/main/generative-ai.generationconfig.responseschema.md
index 86bcf03f..9922cc8b 100644
--- a/docs/reference/main/generative-ai.generationconfig.responseschema.md
+++ b/docs/reference/main/generative-ai.generationconfig.responseschema.md
@@ -9,5 +9,5 @@ Output response schema of the generated candidate text. Note: This only applies
**Signature:**
```typescript
-responseSchema?: ResponseSchema;
+responseSchema?: Schema;
```
diff --git a/docs/reference/main/generative-ai.md b/docs/reference/main/generative-ai.md
index b4a67bb9..bc2045ee 100644
--- a/docs/reference/main/generative-ai.md
+++ b/docs/reference/main/generative-ai.md
@@ -61,8 +61,6 @@
| [FunctionCallingConfig](./generative-ai.functioncallingconfig.md) | |
| [FunctionCallPart](./generative-ai.functioncallpart.md) | Content part interface if the part represents a FunctionCall. |
| [FunctionDeclaration](./generative-ai.functiondeclaration.md) | Structured representation of a function declaration as defined by the \[OpenAPI 3.0 specification\](https://spec.openapis.org/oas/v3.0.3). Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client. |
-| [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | Schema for parameters passed to [FunctionDeclaration.parameters](./generative-ai.functiondeclaration.parameters.md). |
-| [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md) | Schema for top-level function declaration |
| [FunctionDeclarationsTool](./generative-ai.functiondeclarationstool.md) | A FunctionDeclarationsTool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. |
| [FunctionResponse](./generative-ai.functionresponse.md) | The result output from a \[FunctionCall\] that contains a string representing the \[FunctionDeclaration.name\] and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a \[FunctionCall\] made based on model prediction. |
| [FunctionResponsePart](./generative-ai.functionresponsepart.md) | Content part interface if the part represents FunctionResponse. |
@@ -77,7 +75,6 @@
| [ModelParams](./generative-ai.modelparams.md) | Params passed to [GoogleGenerativeAI.getGenerativeModel()](./generative-ai.googlegenerativeai.getgenerativemodel.md). |
| [PromptFeedback](./generative-ai.promptfeedback.md) | If the prompt was blocked, this will be populated with blockReason
and the relevant safetyRatings
. |
| [RequestOptions](./generative-ai.requestoptions.md) | Params passed to getGenerativeModel() or GoogleAIFileManager(). |
-| [ResponseSchema](./generative-ai.responseschema.md) | Schema passed to GenerationConfig.responseSchema
|
| [SafetyRating](./generative-ai.safetyrating.md) | A safety rating associated with a [GenerateContentCandidate](./generative-ai.generatecontentcandidate.md) |
| [SafetySetting](./generative-ai.safetysetting.md) | Safety setting that can be sent as part of request parameters. |
| [Schema](./generative-ai.schema.md) | 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. |
diff --git a/docs/reference/main/generative-ai.responseschema.md b/docs/reference/main/generative-ai.responseschema.md
deleted file mode 100644
index ad848a6e..00000000
--- a/docs/reference/main/generative-ai.responseschema.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [ResponseSchema](./generative-ai.responseschema.md)
-
-## ResponseSchema interface
-
-Schema passed to `GenerationConfig.responseSchema`
-
-**Signature:**
-
-```typescript
-export interface ResponseSchema extends Schema
-```
-**Extends:** [Schema](./generative-ai.schema.md)
-
diff --git a/docs/reference/main/generative-ai.schema.items.md b/docs/reference/main/generative-ai.schema.items.md
index 4774e827..f4ecf49d 100644
--- a/docs/reference/main/generative-ai.schema.items.md
+++ b/docs/reference/main/generative-ai.schema.items.md
@@ -4,10 +4,10 @@
## Schema.items property
-Optional. The items of the property. [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)
+Optional. The items of the property.
**Signature:**
```typescript
-items?: FunctionDeclarationSchema;
+items?: Schema;
```
diff --git a/docs/reference/main/generative-ai.schema.md b/docs/reference/main/generative-ai.schema.md
index 27fddfb4..58e39586 100644
--- a/docs/reference/main/generative-ai.schema.md
+++ b/docs/reference/main/generative-ai.schema.md
@@ -20,9 +20,9 @@ export interface Schema
| [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) |
+| [items?](./generative-ai.schema.items.md) | | [Schema](./generative-ai.schema.md) | _(Optional)_ Optional. The items of the property. |
| [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). |
+| [properties?](./generative-ai.schema.properties.md) | | { \[k: string\]: [Schema](./generative-ai.schema.md); } | _(Optional)_ Optional. Map of [Schema](./generative-ai.schema.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). |
diff --git a/docs/reference/main/generative-ai.schema.properties.md b/docs/reference/main/generative-ai.schema.properties.md
index 5e055570..1f19b575 100644
--- a/docs/reference/main/generative-ai.schema.properties.md
+++ b/docs/reference/main/generative-ai.schema.properties.md
@@ -4,12 +4,12 @@
## Schema.properties property
-Optional. Map of [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md).
+Optional. Map of [Schema](./generative-ai.schema.md).
**Signature:**
```typescript
properties?: {
- [k: string]: FunctionDeclarationSchema;
+ [k: string]: Schema;
};
```
diff --git a/docs/reference/server/generative-ai.functiondeclaration.md b/docs/reference/server/generative-ai.functiondeclaration.md
index 1657ab4b..71ac272a 100644
--- a/docs/reference/server/generative-ai.functiondeclaration.md
+++ b/docs/reference/server/generative-ai.functiondeclaration.md
@@ -18,5 +18,5 @@ export declare interface FunctionDeclaration
| --- | --- | --- | --- |
| [description?](./generative-ai.functiondeclaration.description.md) | | string | _(Optional)_ Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. |
| [name](./generative-ai.functiondeclaration.name.md) | | 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?](./generative-ai.functiondeclaration.parameters.md) | | [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | _(Optional)_ Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. |
+| [parameters?](./generative-ai.functiondeclaration.parameters.md) | | [Schema](./generative-ai.schema.md) | _(Optional)_ Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. |
diff --git a/docs/reference/server/generative-ai.functiondeclaration.parameters.md b/docs/reference/server/generative-ai.functiondeclaration.parameters.md
index f6005c5b..0d26c7df 100644
--- a/docs/reference/server/generative-ai.functiondeclaration.parameters.md
+++ b/docs/reference/server/generative-ai.functiondeclaration.parameters.md
@@ -9,7 +9,7 @@ Optional. Describes the parameters to this function in JSON Schema Object format
**Signature:**
```typescript
-parameters?: FunctionDeclarationSchema;
+parameters?: Schema;
```
## Example
diff --git a/docs/reference/server/generative-ai.functiondeclarationschema.description.md b/docs/reference/server/generative-ai.functiondeclarationschema.description.md
deleted file mode 100644
index a8d37cec..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschema.description.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [description](./generative-ai.functiondeclarationschema.description.md)
-
-## FunctionDeclarationSchema.description property
-
-Optional. Description of the parameter.
-
-**Signature:**
-
-```typescript
-description?: string;
-```
diff --git a/docs/reference/server/generative-ai.functiondeclarationschema.md b/docs/reference/server/generative-ai.functiondeclarationschema.md
deleted file mode 100644
index 0af8377b..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschema.md
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)
-
-## FunctionDeclarationSchema interface
-
-Schema for parameters passed to [FunctionDeclaration.parameters](./generative-ai.functiondeclaration.parameters.md).
-
-**Signature:**
-
-```typescript
-export interface FunctionDeclarationSchema
-```
-
-## Properties
-
-| Property | Modifiers | Type | Description |
-| --- | --- | --- | --- |
-| [description?](./generative-ai.functiondeclarationschema.description.md) | | string | _(Optional)_ Optional. Description of the parameter. |
-| [properties](./generative-ai.functiondeclarationschema.properties.md) | | { \[k: string\]: [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md); } | The format of the parameter. |
-| [required?](./generative-ai.functiondeclarationschema.required.md) | | string\[\] | _(Optional)_ Optional. Array of required parameters. |
-| [type](./generative-ai.functiondeclarationschema.type.md) | | [FunctionDeclarationSchemaType](./generative-ai.functiondeclarationschematype.md) | The type of the parameter. |
-
diff --git a/docs/reference/server/generative-ai.functiondeclarationschema.properties.md b/docs/reference/server/generative-ai.functiondeclarationschema.properties.md
deleted file mode 100644
index b1642c49..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschema.properties.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [properties](./generative-ai.functiondeclarationschema.properties.md)
-
-## FunctionDeclarationSchema.properties property
-
-The format of the parameter.
-
-**Signature:**
-
-```typescript
-properties: {
- [k: string]: FunctionDeclarationSchemaProperty;
- };
-```
diff --git a/docs/reference/server/generative-ai.functiondeclarationschema.required.md b/docs/reference/server/generative-ai.functiondeclarationschema.required.md
deleted file mode 100644
index fdddab0b..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschema.required.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [required](./generative-ai.functiondeclarationschema.required.md)
-
-## FunctionDeclarationSchema.required property
-
-Optional. Array of required parameters.
-
-**Signature:**
-
-```typescript
-required?: string[];
-```
diff --git a/docs/reference/server/generative-ai.functiondeclarationschema.type.md b/docs/reference/server/generative-ai.functiondeclarationschema.type.md
deleted file mode 100644
index 7d336a82..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschema.type.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) > [type](./generative-ai.functiondeclarationschema.type.md)
-
-## FunctionDeclarationSchema.type property
-
-The type of the parameter.
-
-**Signature:**
-
-```typescript
-type: FunctionDeclarationSchemaType;
-```
diff --git a/docs/reference/server/generative-ai.functiondeclarationschemaproperty.md b/docs/reference/server/generative-ai.functiondeclarationschemaproperty.md
deleted file mode 100644
index b0303af1..00000000
--- a/docs/reference/server/generative-ai.functiondeclarationschemaproperty.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md)
-
-## FunctionDeclarationSchemaProperty interface
-
-Schema for top-level function declaration
-
-**Signature:**
-
-```typescript
-export interface FunctionDeclarationSchemaProperty extends Schema
-```
-**Extends:** [Schema](./generative-ai.schema.md)
-
diff --git a/docs/reference/server/generative-ai.md b/docs/reference/server/generative-ai.md
index c17b2131..2d37eac8 100644
--- a/docs/reference/server/generative-ai.md
+++ b/docs/reference/server/generative-ai.md
@@ -44,8 +44,6 @@
| [FunctionCallingConfig](./generative-ai.functioncallingconfig.md) | |
| [FunctionCallPart](./generative-ai.functioncallpart.md) | Content part interface if the part represents a FunctionCall. |
| [FunctionDeclaration](./generative-ai.functiondeclaration.md) | Structured representation of a function declaration as defined by the \[OpenAPI 3.0 specification\](https://spec.openapis.org/oas/v3.0.3). Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client. |
-| [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md) | Schema for parameters passed to [FunctionDeclaration.parameters](./generative-ai.functiondeclaration.parameters.md). |
-| [FunctionDeclarationSchemaProperty](./generative-ai.functiondeclarationschemaproperty.md) | Schema for top-level function declaration |
| [FunctionDeclarationsTool](./generative-ai.functiondeclarationstool.md) | A FunctionDeclarationsTool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. |
| [FunctionResponse](./generative-ai.functionresponse.md) | The result output from a \[FunctionCall\] that contains a string representing the \[FunctionDeclaration.name\] and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a \[FunctionCall\] made based on model prediction. |
| [FunctionResponsePart](./generative-ai.functionresponsepart.md) | Content part interface if the part represents FunctionResponse. |
@@ -55,7 +53,6 @@
| [ListFilesResponse](./generative-ai.listfilesresponse.md) | Response from calling [GoogleAIFileManager.listFiles()](./generative-ai.googleaifilemanager.listfiles.md) |
| [ListParams](./generative-ai.listparams.md) | Params to pass to [GoogleAIFileManager.listFiles()](./generative-ai.googleaifilemanager.listfiles.md) or [GoogleAICacheManager.list()](./generative-ai.googleaicachemanager.list.md) |
| [RequestOptions](./generative-ai.requestoptions.md) | Params passed to getGenerativeModel() or GoogleAIFileManager(). |
-| [ResponseSchema](./generative-ai.responseschema.md) | Schema passed to GenerationConfig.responseSchema
|
| [RpcStatus](./generative-ai.rpcstatus.md) | Standard RPC error status object. |
| [Schema](./generative-ai.schema.md) | 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. |
| [TextPart](./generative-ai.textpart.md) | Content part interface if the part represents a text string. |
diff --git a/docs/reference/server/generative-ai.responseschema.md b/docs/reference/server/generative-ai.responseschema.md
deleted file mode 100644
index ad848a6e..00000000
--- a/docs/reference/server/generative-ai.responseschema.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [ResponseSchema](./generative-ai.responseschema.md)
-
-## ResponseSchema interface
-
-Schema passed to `GenerationConfig.responseSchema`
-
-**Signature:**
-
-```typescript
-export interface ResponseSchema extends Schema
-```
-**Extends:** [Schema](./generative-ai.schema.md)
-
diff --git a/docs/reference/server/generative-ai.schema.items.md b/docs/reference/server/generative-ai.schema.items.md
index 4774e827..f4ecf49d 100644
--- a/docs/reference/server/generative-ai.schema.items.md
+++ b/docs/reference/server/generative-ai.schema.items.md
@@ -4,10 +4,10 @@
## Schema.items property
-Optional. The items of the property. [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md)
+Optional. The items of the property.
**Signature:**
```typescript
-items?: FunctionDeclarationSchema;
+items?: Schema;
```
diff --git a/docs/reference/server/generative-ai.schema.md b/docs/reference/server/generative-ai.schema.md
index 27fddfb4..58e39586 100644
--- a/docs/reference/server/generative-ai.schema.md
+++ b/docs/reference/server/generative-ai.schema.md
@@ -20,9 +20,9 @@ export interface Schema
| [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) |
+| [items?](./generative-ai.schema.items.md) | | [Schema](./generative-ai.schema.md) | _(Optional)_ Optional. The items of the property. |
| [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). |
+| [properties?](./generative-ai.schema.properties.md) | | { \[k: string\]: [Schema](./generative-ai.schema.md); } | _(Optional)_ Optional. Map of [Schema](./generative-ai.schema.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). |
diff --git a/docs/reference/server/generative-ai.schema.properties.md b/docs/reference/server/generative-ai.schema.properties.md
index 5e055570..1f19b575 100644
--- a/docs/reference/server/generative-ai.schema.properties.md
+++ b/docs/reference/server/generative-ai.schema.properties.md
@@ -4,12 +4,12 @@
## Schema.properties property
-Optional. Map of [FunctionDeclarationSchema](./generative-ai.functiondeclarationschema.md).
+Optional. Map of [Schema](./generative-ai.schema.md).
**Signature:**
```typescript
properties?: {
- [k: string]: FunctionDeclarationSchema;
+ [k: string]: Schema;
};
```
diff --git a/package.json b/package.json
index f6e6a7a1..785ba6d3 100644
--- a/package.json
+++ b/package.json
@@ -52,4 +52,4 @@
"packages/*"
],
"version": "0.0.1"
-}
+}
\ No newline at end of file
diff --git a/packages/main/src/models/generative-model.test.ts b/packages/main/src/models/generative-model.test.ts
index 61cb630e..6ee24a13 100644
--- a/packages/main/src/models/generative-model.test.ts
+++ b/packages/main/src/models/generative-model.test.ts
@@ -59,8 +59,10 @@ describe("GenerativeModel", () => {
type: FunctionDeclarationSchemaType.OBJECT,
properties: {
testField: {
- type: FunctionDeclarationSchemaType.STRING,
- properties: {},
+ type: FunctionDeclarationSchemaType.ARRAY,
+ items: {
+ type: FunctionDeclarationSchemaType.STRING,
+ },
},
},
},
@@ -90,6 +92,9 @@ describe("GenerativeModel", () => {
);
expect(
genModel.generationConfig?.responseSchema.properties.testField.type,
+ ).to.equal(FunctionDeclarationSchemaType.ARRAY);
+ expect(
+ genModel.generationConfig?.responseSchema.properties.testField.items.type,
).to.equal(FunctionDeclarationSchemaType.STRING);
expect(genModel.safetySettings?.length).to.equal(1);
expect(genModel.tools?.length).to.equal(1);
diff --git a/packages/main/types/function-calling.ts b/packages/main/types/function-calling.ts
index ff9df2ce..79223900 100644
--- a/packages/main/types/function-calling.ts
+++ b/packages/main/types/function-calling.ts
@@ -56,7 +56,7 @@ export declare interface FunctionDeclaration {
* - param1
* ```
*/
- parameters?: FunctionDeclarationSchema;
+ parameters?: Schema;
}
/**
@@ -117,45 +117,18 @@ export interface Schema {
description?: string;
/** Optional. Whether the property is nullable. */
nullable?: boolean;
- /** Optional. The items of the property. {@link FunctionDeclarationSchema} */
- items?: FunctionDeclarationSchema;
+ /** Optional. The items of the property. */
+ items?: Schema;
/** Optional. The enum of the property. */
enum?: string[];
- /** Optional. Map of {@link FunctionDeclarationSchema}. */
- properties?: { [k: string]: FunctionDeclarationSchema };
+ /** Optional. Map of {@link Schema}. */
+ properties?: { [k: string]: Schema };
/** Optional. Array of required property. */
required?: string[];
/** Optional. The example of the property. */
example?: unknown;
}
-/**
- * Schema for parameters passed to {@link FunctionDeclaration.parameters}.
- * @public
- */
-export interface FunctionDeclarationSchema {
- /** The type of the parameter. */
- type: FunctionDeclarationSchemaType;
- /** The format of the parameter. */
- properties: { [k: string]: FunctionDeclarationSchemaProperty };
- /** Optional. Description of the parameter. */
- description?: string;
- /** Optional. Array of required parameters. */
- required?: string[];
-}
-
-/**
- * Schema for top-level function declaration
- * @public
- */
-export interface FunctionDeclarationSchemaProperty extends Schema {}
-
-/**
- * Schema passed to `GenerationConfig.responseSchema`
- * @public
- */
-export interface ResponseSchema extends Schema {}
-
/**
* Tool config. This config is shared for all tools provided in the request.
* @public
diff --git a/packages/main/types/requests.ts b/packages/main/types/requests.ts
index 03223fd3..be76f284 100644
--- a/packages/main/types/requests.ts
+++ b/packages/main/types/requests.ts
@@ -20,7 +20,7 @@ import { Content, Part } from "./content";
import { HarmBlockThreshold, HarmCategory, TaskType } from "./enums";
import {
FunctionDeclarationsTool,
- ResponseSchema,
+ Schema,
ToolConfig,
} from "./function-calling";
@@ -101,7 +101,7 @@ export interface GenerationConfig {
* Note: This only applies when the specified `responseMIMEType` supports a schema; currently
* this is limited to `application/json`.
*/
- responseSchema?: ResponseSchema;
+ responseSchema?: Schema;
}
/**