Skip to content
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

[Vertex GA] Rewrite Schema #8479

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

// @public
export class ArraySchema extends Schema {
constructor(schemaParams: SchemaParams, items: TypedSchema);
// (undocumented)
items: TypedSchema;
// @internal (undocumented)
toJSON(): SchemaRequest;
}

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

// @public
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 +217,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?: ObjectSchemaInterface;
}

// @public
Expand Down Expand Up @@ -331,6 +310,7 @@ export interface GenerationConfig {
// (undocumented)
presencePenalty?: number;
responseMimeType?: string;
responseSchema?: TypedSchema | SchemaRequest;
// (undocumented)
stopSequences?: string[];
// (undocumented)
Expand Down Expand Up @@ -478,6 +458,11 @@ export interface InlineDataPart {
videoMetadata?: VideoMetadata;
}

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

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

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

// @public
export class ObjectSchema extends Schema {
constructor(schemaParams: SchemaParams, properties: {
[k: string]: TypedSchema;
}, optionalProperties?: string[]);
// (undocumented)
optionalProperties: string[];
// (undocumented)
properties: {
[k: string]: TypedSchema;
};
// @internal (undocumented)
toJSON(): SchemaRequest;
}

// @public
export interface ObjectSchemaInterface extends SchemaInterface {
// (undocumented)
optionalProperties?: string[];
// (undocumented)
type: SchemaType.OBJECT;
}

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

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

// @public
export abstract class Schema implements SchemaInterface {
constructor(schemaParams: SchemaInterface);
[key: string]: unknown;
// (undocumented)
static array(arrayParams: SchemaParams & {
items: Schema;
}): ArraySchema;
// (undocumented)
static boolean(booleanParams?: SchemaParams): BooleanSchema;
description?: string;
// (undocumented)
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
example?: unknown;
format?: string;
// (undocumented)
static integer(integerParams?: SchemaParams): IntegerSchema;
nullable: boolean;
// (undocumented)
static number(numberParams?: SchemaParams): NumberSchema;
// (undocumented)
static object(objectParams: SchemaParams & {
properties: {
[k: string]: Schema;
};
optionalProperties?: string[];
}): ObjectSchema;
// (undocumented)
static string(stringParams?: SchemaParams): StringSchema;
// @internal
toJSON(): SchemaRequest;
type: SchemaType;
}

// @public
export interface SchemaInterface extends SchemaShared<SchemaInterface> {
type: SchemaType;
}

// @public
export interface SchemaParams extends SchemaShared<SchemaInterface> {
}

// @public
export interface SchemaRequest extends SchemaShared<SchemaRequest> {
required?: string[];
type: SchemaType;
}

// @public
export interface SchemaShared<T> {
// (undocumented)
[key: string]: unknown;
description?: string;
enum?: string[];
example?: unknown;
format?: string;
items?: T;
nullable?: boolean;
properties?: {
[k: string]: T;
};
}

// @public
export enum SchemaType {
ARRAY = "array",
BOOLEAN = "boolean",
INTEGER = "integer",
NUMBER = "number",
OBJECT = "object",
STRING = "string"
}

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

// @public
export class StringSchema extends Schema {
constructor(schemaParams?: SchemaParams, enumValues?: string[]);
// (undocumented)
enum?: string[];
// @internal (undocumented)
toJSON(): SchemaRequest;
}

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

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

// @public
export interface UsageMetadata {
// (undocumented)
Expand All @@ -616,15 +717,14 @@ export class VertexAIError extends FirebaseError {
readonly code: VertexAIErrorCode;
// (undocumented)
readonly customErrorData?: CustomErrorData | undefined;
// (undocumented)
readonly message: string;
}

// @public
export const enum VertexAIErrorCode {
ERROR = "error",
FETCH_ERROR = "fetch-error",
INVALID_CONTENT = "invalid-content",
INVALID_SCHEMA = "invalid-schema",
NO_API_KEY = "no-api-key",
NO_MODEL = "no-model",
NO_PROJECT_ID = "no-project-id",
Expand Down
Loading
Loading