Skip to content

Commit bf7d2d8

Browse files
authored
Remove apiVersion and location options (#8124)
1 parent d27cd8e commit bf7d2d8

File tree

8 files changed

+11
-61
lines changed

8 files changed

+11
-61
lines changed

packages/vertexai/src/api.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Provider } from '@firebase/component';
2020
import { getModularInstance } from '@firebase/util';
2121
import { DEFAULT_LOCATION, VERTEX_TYPE } from './constants';
2222
import { VertexAIService } from './service';
23-
import { VertexAI, VertexAIOptions } from './public-types';
23+
import { VertexAI } from './public-types';
2424
import { ERROR_FACTORY, VertexError } from './errors';
2525
import { ModelParams, RequestOptions } from './types';
2626
import { GenerativeModel } from './models/generative-model';
@@ -42,16 +42,13 @@ declare module '@firebase/component' {
4242
*
4343
* @param app - The {@link @firebase/app#FirebaseApp} to use.
4444
*/
45-
export function getVertexAI(
46-
app: FirebaseApp = getApp(),
47-
options?: VertexAIOptions
48-
): VertexAI {
45+
export function getVertexAI(app: FirebaseApp = getApp()): VertexAI {
4946
app = getModularInstance(app);
5047
// Dependencies
5148
const vertexProvider: Provider<'vertex'> = _getProvider(app, VERTEX_TYPE);
5249

5350
return vertexProvider.getImmediate({
54-
identifier: options?.location || DEFAULT_LOCATION
51+
identifier: DEFAULT_LOCATION
5552
});
5653
}
5754

packages/vertexai/src/index.test.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/vertexai/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ function registerVertex(): void {
3737
_registerComponent(
3838
new Component(
3939
VERTEX_TYPE,
40-
(container, { instanceIdentifier: location }) => {
40+
container => {
4141
// getImmediate for FirebaseApp will always succeed
4242
const app = container.getProvider('app').getImmediate();
4343
const appCheckProvider = container.getProvider('app-check-internal');
44-
return new VertexAIService(app, appCheckProvider, { location });
44+
return new VertexAIService(app, appCheckProvider);
4545
},
4646
ComponentType.PUBLIC
4747
).setMultipleInstances(true)

packages/vertexai/src/public-types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ export interface VertexAI {
3030
app: FirebaseApp;
3131
location: string;
3232
}
33-
34-
export interface VertexAIOptions {
35-
location?: string;
36-
}

packages/vertexai/src/requests/request.test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ describe('request methods', () => {
7171
);
7272
expect(url.toString()).to.include(DEFAULT_API_VERSION);
7373
});
74-
it('custom apiVersion', async () => {
75-
const url = new RequestUrl(
76-
'models/model-name',
77-
Task.GENERATE_CONTENT,
78-
fakeApiSettings,
79-
false,
80-
{ apiVersion: 'v100omega' }
81-
);
82-
expect(url.toString()).to.include(
83-
'/v100omega/projects/my-project/locations/us-central1/models/model-name'
84-
);
85-
});
8674
it('custom baseUrl', async () => {
8775
const url = new RequestUrl(
8876
'models/model-name',

packages/vertexai/src/requests/request.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export class RequestUrl {
4040
public requestOptions?: RequestOptions
4141
) {}
4242
toString(): string {
43-
const apiVersion = this.requestOptions?.apiVersion || DEFAULT_API_VERSION;
43+
// TODO: allow user-set option if that feature becomes available
44+
const apiVersion = DEFAULT_API_VERSION;
4445
const baseUrl = this.requestOptions?.baseUrl || DEFAULT_BASE_URL;
4546
let url = `${baseUrl}/${apiVersion}`;
4647
url += `/projects/${this.apiSettings.project}`;

packages/vertexai/src/service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { FirebaseApp, _FirebaseService } from '@firebase/app';
19-
import { VertexAI, VertexAIOptions } from './public-types';
19+
import { VertexAI } from './public-types';
2020
import {
2121
AppCheckInternalComponentName,
2222
FirebaseAppCheckInternal
@@ -30,12 +30,12 @@ export class VertexAIService implements VertexAI, _FirebaseService {
3030

3131
constructor(
3232
public app: FirebaseApp,
33-
appCheckProvider?: Provider<AppCheckInternalComponentName>,
34-
public options?: VertexAIOptions
33+
appCheckProvider?: Provider<AppCheckInternalComponentName>
3534
) {
3635
const appCheck = appCheckProvider?.getImmediate({ optional: true });
3736
this.appCheck = appCheck || null;
38-
this.location = this.options?.location || DEFAULT_LOCATION;
37+
// TODO: add in user-set location option when that feature is available
38+
this.location = DEFAULT_LOCATION;
3939
}
4040

4141
_delete(): Promise<void> {

packages/vertexai/src/types/requests.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ export interface RequestOptions {
9393
* Request timeout in milliseconds.
9494
*/
9595
timeout?: number;
96-
/**
97-
* Version of API endpoint to call (e.g. "v1" or "v1beta"). If not specified,
98-
* defaults to latest stable version.
99-
*/
100-
apiVersion?: string;
10196
/**
10297
* Base url for endpoint. Defaults to https://firebaseml.googleapis.com
10398
*/

0 commit comments

Comments
 (0)