Skip to content

Commit 3b5daae

Browse files
authoredAug 12, 2024
Fix Schema type to reference itself in its child properties (#222)
1 parent 27e2f97 commit 3b5daae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+190
-139
lines changed
 

‎.changeset/breezy-scissors-attend.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@google/generative-ai": minor
3+
---
4+
5+
Fix `Schema` type to reference itself and not a derived type in its `items` array and `properties` map.

‎common/api-review/generative-ai-server.api.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,13 @@ export interface FunctionDeclarationSchema {
282282
[k: string]: FunctionDeclarationSchemaProperty;
283283
};
284284
required?: string[];
285-
type: FunctionDeclarationSchemaType;
285+
type: SchemaType;
286286
}
287287

288288
// @public
289289
export interface FunctionDeclarationSchemaProperty extends Schema {
290290
}
291291

292-
// @public
293-
export enum FunctionDeclarationSchemaType {
294-
ARRAY = "ARRAY",
295-
BOOLEAN = "BOOLEAN",
296-
INTEGER = "INTEGER",
297-
NUMBER = "NUMBER",
298-
OBJECT = "OBJECT",
299-
STRING = "STRING"
300-
}
301-
302292
// @public
303293
export interface FunctionDeclarationsTool {
304294
functionDeclarations?: FunctionDeclaration[];
@@ -356,7 +346,6 @@ export class GoogleAIFileManager {
356346
apiKey: string;
357347
deleteFile(fileId: string): Promise<void>;
358348
getFile(fileId: string, requestOptions?: SingleRequestOptions): Promise<FileMetadataResponse>;
359-
// Warning: (ae-forgotten-export) The symbol "SingleRequestOptions" needs to be exported by the entry point index.d.ts
360349
listFiles(listParams?: ListParams, requestOptions?: SingleRequestOptions): Promise<ListFilesResponse>;
361350
uploadFile(filePath: string, fileMetadata: FileMetadata): Promise<UploadFileResponse>;
362351
}
@@ -440,13 +429,28 @@ export interface Schema {
440429
enum?: string[];
441430
example?: unknown;
442431
format?: string;
443-
items?: FunctionDeclarationSchema;
432+
items?: Schema;
444433
nullable?: boolean;
445434
properties?: {
446-
[k: string]: FunctionDeclarationSchema;
435+
[k: string]: Schema;
447436
};
448437
required?: string[];
449-
type?: FunctionDeclarationSchemaType;
438+
type?: SchemaType;
439+
}
440+
441+
// @public
442+
export enum SchemaType {
443+
ARRAY = "ARRAY",
444+
BOOLEAN = "BOOLEAN",
445+
INTEGER = "INTEGER",
446+
NUMBER = "NUMBER",
447+
OBJECT = "OBJECT",
448+
STRING = "STRING"
449+
}
450+
451+
// @public
452+
export interface SingleRequestOptions extends RequestOptions {
453+
signal?: AbortSignal;
450454
}
451455

452456
// @public

0 commit comments

Comments
 (0)