Skip to content

[Vertex GA] Rewrite Schema #8479

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

Merged
merged 24 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
132 changes: 96 additions & 36 deletions common/api-review/vertexai-preview.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';

// @public (undocumented)
export class ArraySchema extends Schema {
// Warning: (ae-forgotten-export) The symbol "SchemaParams" needs to be exported by the entry point index.d.ts
constructor(schemaParams: SchemaParams, items: TypedSchema);
// (undocumented)
items: TypedSchema;
// (undocumented)
toJSON(): Record<string, unknown>;
}

// @public
export interface BaseParams {
// (undocumented)
Expand All @@ -27,6 +37,11 @@ export enum BlockReason {
SAFETY = "SAFETY"
}

// @public (undocumented)
export class BooleanSchema extends Schema {
constructor(schemaParams?: SchemaParams);
}

// @public
export class ChatSession {
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -203,42 +218,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 {
description?: string;
enum?: string[];
example?: unknown;
format?: string;
items?: FunctionDeclarationSchema;
nullable?: boolean;
properties?: {
[k: string]: FunctionDeclarationSchema;
};
required?: string[];
type?: FunctionDeclarationSchemaType;
}

// @public
export enum FunctionDeclarationSchemaType {
ARRAY = "ARRAY",
BOOLEAN = "BOOLEAN",
INTEGER = "INTEGER",
NUMBER = "NUMBER",
OBJECT = "OBJECT",
STRING = "STRING"
parameters?: ObjectSchema;
}

// @public
Expand Down Expand Up @@ -332,6 +312,8 @@ export interface GenerationConfig {
presencePenalty?: number;
responseMimeType?: string;
// (undocumented)
responseSchema?: TypedSchema;
// (undocumented)
stopSequences?: string[];
// (undocumented)
temperature?: number;
Expand Down Expand Up @@ -478,6 +460,11 @@ export interface InlineDataPart {
videoMetadata?: VideoMetadata;
}

// @public (undocumented)
export class IntegerSchema extends Schema {
constructor(schemaParams?: SchemaParams);
}

// @public
export interface ModelParams extends BaseParams {
// (undocumented)
Expand All @@ -490,6 +477,24 @@ export interface ModelParams extends BaseParams {
tools?: Tool[];
}

// @public (undocumented)
export class NumberSchema extends Schema {
constructor(schemaParams?: SchemaParams);
}

// @public (undocumented)
export class ObjectSchema extends Schema {
constructor(schemaParams: SchemaParams, properties: {
[k: string]: TypedSchema;
});
// (undocumented)
properties: {
[k: string]: TypedSchema;
};
// (undocumented)
toJSON(): Record<string, unknown>;
}

// @public
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;

Expand Down Expand Up @@ -549,6 +554,49 @@ export interface SafetySetting {
threshold: HarmBlockThreshold;
}

// Warning: (ae-forgotten-export) The symbol "SchemaInterface" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export abstract class Schema implements SchemaInterface {
constructor(schemaParams: SchemaInterface);
// (undocumented)
static createArray(arrayParams: SchemaParams & {
items: Schema;
}): ArraySchema;
// (undocumented)
static createBoolean(booleanParams?: SchemaParams): BooleanSchema;
// (undocumented)
static createEnumString(stringParams: SchemaParams & {
enumValues: string[];
}): StringSchema;
// (undocumented)
static createFunctionDeclaration(objectParams: SchemaParams & {
properties: {
[k: string]: Schema;
};
}): ObjectSchema;
// (undocumented)
static createInteger(integerParams?: SchemaParams): IntegerSchema;
// (undocumented)
static createNumber(numberParams?: SchemaParams): NumberSchema;
// (undocumented)
static createObject(objectParams: SchemaParams & {
properties: {
[k: string]: Schema;
};
}): ObjectSchema;
// (undocumented)
static createString(stringParams?: SchemaParams): StringSchema;
description?: string;
example?: unknown;
format?: string;
nullable: boolean;
required: boolean;
toJSON(): Record<string, unknown>;
// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts
type: SchemaType;
}

// @public (undocumented)
export interface Segment {
// (undocumented)
Expand All @@ -571,6 +619,15 @@ export interface StartChatParams extends BaseParams {
tools?: Tool[];
}

// @public (undocumented)
export class StringSchema extends Schema {
constructor(schemaParams?: SchemaParams, enumValues?: string[] | undefined);
// (undocumented)
enumValues?: string[] | undefined;
// (undocumented)
toJSON(): Record<string, unknown>;
}

// @public
export interface TextPart {
// (undocumented)
Expand All @@ -592,6 +649,9 @@ export interface ToolConfig {
functionCallingConfig: FunctionCallingConfig;
}

// @public (undocumented)
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;

// @public
export interface UsageMetadata {
// (undocumented)
Expand Down
1 change: 1 addition & 0 deletions packages/vertexai/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { VertexAIError } from './errors';
import { GenerativeModel } from './models/generative-model';

export { ChatSession } from './methods/chat-session';
export * from './requests/schema-builder';

export { GenerativeModel };

Expand Down
Loading