Skip to content

feat!(ai): Remove the vertexai import alias #9080

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/late-beers-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'firebase': major
---

Remove `vertexai` import path
5 changes: 0 additions & 5 deletions .changeset/spotty-ghosts-kneel.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/tricky-years-pump.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ body:
description: Select the Firebase product(s) relevant to your issue. You can select multiple options in the dropdown.
multiple: true
options:
- AI
- Analytics
- AppCheck
- Auth
Expand All @@ -72,7 +73,6 @@ body:
- Performance
- Remote-Config
- Storage
- VertexAI
validations:
required: true
- type: textarea
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:

defaults:
run:
# Run any command steps in the /e2e subdir
working-directory: './e2e'
# Run any command steps in the /e2e/smoke-tests subdir
working-directory: './e2e/smoke-tests'

steps:
- name: Checkout Repo
Expand All @@ -53,7 +53,9 @@ jobs:
- name: Poll npm until version to test is available for install
run: |
echo "Polling npm for firebase@${{ github.event.client_payload.versionOrTag }}"
node ../scripts/release/poll-npm-publish.js
node ./scripts/release/poll-npm-publish.js
# run in root
working-directory: '.'
env:
VERSION: ${{ github.event.client_payload.versionOrTag }}
- name: Yarn install
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ vertexai-sdk-test-data
mocks-lookup.ts

# temp changeset output
changeset-temp.json
changeset-temp.json
22 changes: 21 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
"cwd": "${workspaceRoot}/packages/vertexai",
"cwd": "${workspaceRoot}/packages/ai",
"args": [
"--require",
"ts-node/register",
Expand All @@ -24,6 +24,26 @@
},
"sourceMaps": true
},
{
"name": "AI Integration Tests (node)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
"cwd": "${workspaceRoot}/packages/ai",
"args": [
"--require",
"ts-node/register",
"--require",
"src/index.node.ts",
"--timeout",
"5000",
"integration/**/*.test.ts"
],
"env": {
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
},
"sourceMaps": true
},
{
"type": "node",
"request": "launch",
Expand Down
5 changes: 5 additions & 0 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ export abstract class Schema implements SchemaInterface {
format?: string;
// (undocumented)
static integer(integerParams?: SchemaParams): IntegerSchema;
items?: SchemaInterface;
maxItems?: number;
minItems?: number;
nullable: boolean;
// (undocumented)
static number(numberParams?: SchemaParams): NumberSchema;
Expand Down Expand Up @@ -833,7 +836,9 @@ export interface SchemaShared<T> {
format?: string;
items?: T;
maximum?: number;
maxItems?: number;
minimum?: number;
minItems?: number;
nullable?: boolean;
properties?: {
[k: string]: T;
Expand Down
33 changes: 33 additions & 0 deletions docs-devsite/ai.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export declare abstract class Schema implements SchemaInterface
| [description](./ai.schema.md#schemadescription) | | string | Optional. The description of the property. |
| [example](./ai.schema.md#schemaexample) | | unknown | Optional. The example of the property. |
| [format](./ai.schema.md#schemaformat) | | string | Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBER type: "float", "double"</li> <li>for INTEGER type: "int32", "int64"</li> <li>for STRING type: "email", "byte", etc</li> </ul> |
| [items](./ai.schema.md#schemaitems) | | [SchemaInterface](./ai.schemainterface.md#schemainterface_interface) | Optional. The items of the property. |
| [maxItems](./ai.schema.md#schemamaxitems) | | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
| [minItems](./ai.schema.md#schemaminitems) | | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
| [nullable](./ai.schema.md#schemanullable) | | boolean | Optional. Whether the property is nullable. Defaults to false. |
| [type](./ai.schema.md#schematype) | | [SchemaType](./ai.md#schematype) | Optional. The type of the property. [SchemaType](./ai.md#schematype)<!-- -->. |

Expand Down Expand Up @@ -93,6 +96,36 @@ Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBE
format?: string;
```

## Schema.items

Optional. The items of the property.

<b>Signature:</b>

```typescript
items?: SchemaInterface;
```

## Schema.maxItems

The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.

<b>Signature:</b>

```typescript
maxItems?: number;
```

## Schema.minItems

The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.

<b>Signature:</b>

```typescript
minItems?: number;
```

## Schema.nullable

Optional. Whether the property is nullable. Defaults to false.
Expand Down
22 changes: 22 additions & 0 deletions docs-devsite/ai.schemashared.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export interface SchemaShared<T>
| [format](./ai.schemashared.md#schemasharedformat) | string | Optional. The format of the property. When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this must be either <code>'enum'</code> or <code>'date-time'</code>, otherwise requests will fail. |
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
| [maximum](./ai.schemashared.md#schemasharedmaximum) | number | The maximum value of a numeric type. |
| [maxItems](./ai.schemashared.md#schemasharedmaxitems) | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
| [minimum](./ai.schemashared.md#schemasharedminimum) | number | The minimum value of a numeric type. |
| [minItems](./ai.schemashared.md#schemasharedminitems) | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
| [propertyOrdering](./ai.schemashared.md#schemasharedpropertyordering) | string\[\] | A hint suggesting the order in which the keys should appear in the generated JSON string. |
Expand Down Expand Up @@ -94,6 +96,16 @@ The maximum value of a numeric type.
maximum?: number;
```

## SchemaShared.maxItems

The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.

<b>Signature:</b>

```typescript
maxItems?: number;
```

## SchemaShared.minimum

The minimum value of a numeric type.
Expand All @@ -104,6 +116,16 @@ The minimum value of a numeric type.
minimum?: number;
```

## SchemaShared.minItems

The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.

<b>Signature:</b>

```typescript
minItems?: number;
```

## SchemaShared.nullable

Optional. Whether the property is nullable.
Expand Down
95 changes: 7 additions & 88 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,11 @@
# Firebase JS SDK E2E Tests
# E2E Tests

This directory contains end-to-end tests for the Firebase JS SDK package as well as minimal quick start sample apps for debugging and development.
This directory is for Firebase E2E tests that are completely independent of the main SDK workspaces. Packages in here should:

## E2E Tests
* Have a start trigger independent of the main CI PR/push triggers (e.g., manual trigger, repository_dispatch, from an external runner like Kokoro, etc.)

A common use case might be to clone this repo, cd into the chosen directory under e2e, npm install, and run npm scripts.

### Setup
* Have a self-contained set of NPM dependencies. They should not depend on the local version of Firebase in the SDK nor assume inherited availability of any packages in the top level package.json of this repo (typescript, firebase, karma, etc.).

Before running the tests, you will need:

- a project config
- a test user with an email/password login which has read/write privileges for Storage, Realtime Database, and Firestore
- an App Check debug token
- to deploy the `callTest` Cloud Function

#### Project Config and Test User

Create a file named `firebase-config.js` in the top level of this `e2e/` directory. The contents of the file should be:

```javascript
// A config for a project
export const config = {
apiKey: ************,
authDomain: ************,
databaseURL: ************,
projectId: ************,
storageBucket: ************,
messagingSenderId: ************,
appId: ************,
measurementId: ************
};
*
// A user account with read/write privileges in that project
// for storage, database, firestore
export const testAccount = {
email: ************,
password: ************
}
```

#### App Check Debug Token

Create an App Check debug token in the Firebase Console. Assign it to an environment variable in your shell named `APP_CHECK_DEBUG_TOKEN`.

#### Deploy `callTest` Cloud Function

From the top level of the firebase repo, ensure you have the Firebase CLI (`firebase-tools`) installed (if not, `npm install -g firebase-tools`).

Ensure you are logged in using the CLI (`firebase login`);

Then deploy the function with:
`firebase deploy --only functions:callTest --project YOUR_PROJECT_ID`

### Running the Tests

To run the tests on the default modular API:

```
yarn test:modular
```

To run the tests on the compat API:

```
yarn test:compat
```

## Sample Apps

Two minimal sample apps are provided for quick debugging and development. These apps import and initialize every product in the SDK and call some basic methods. Products can easily be commented out to focus on one or more products you are interested in looking at.

### Setup

The setup is the same as for the E2E tests above. Certain tests can be skipped if you are commenting out that product (e.g, no need to deploy the Cloud Function if you are commenting out the `callFunctions()` line in the sample app, and no need to set the App Check debug token env variable if not using App Check).

### Running Sample Apps

To run the modular sample app (uses current default version of the API):

```
yarn start:modular
```

Then open `localhost:8080` in a browser.

To run the compat sample app (uses current compat version of the API):

```
yarn start:compat
```

Then open `localhost:8080` in a browser.
See the `template/` directory for an example.
Loading
Loading