Skip to content

Commit 5c518b1

Browse files
committed
formatting
1 parent 8471bbc commit 5c518b1

File tree

6 files changed

+78
-30
lines changed

6 files changed

+78
-30
lines changed
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
export * from './vertexai-model';
219
export * from './generative-model';
3-
export * from './imagen-model';
20+
export * from './imagen-model';

packages/vertexai/src/models/vertexai-model.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ use(sinonChai);
2727
*/
2828
class TestModel extends VertexAIModel {
2929
/* eslint-disable @typescript-eslint/no-useless-constructor */
30-
constructor(
31-
vertexAI: VertexAI,
32-
modelName: string
33-
) {
30+
constructor(vertexAI: VertexAI, modelName: string) {
3431
super(vertexAI, modelName);
3532
}
3633
}
@@ -57,7 +54,10 @@ describe('VertexAIModel', () => {
5754
expect(testModel.model).to.equal('publishers/google/models/my-model');
5855
});
5956
it('handles full model name', () => {
60-
const testModel = new TestModel(fakeVertexAI, 'publishers/google/models/my-model');
57+
const testModel = new TestModel(
58+
fakeVertexAI,
59+
'publishers/google/models/my-model'
60+
);
6161
expect(testModel.model).to.equal('publishers/google/models/my-model');
6262
});
6363
it('handles prefixed tuned model name', () => {

packages/vertexai/src/models/vertexai-model.ts

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
import { VertexAIError } from "../errors";
2-
import { VertexAI, VertexAIErrorCode } from "../public-types";
3-
import { VertexAIService } from "../service";
4-
import { ApiSettings } from "../types/internal";
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { VertexAIError } from '../errors';
19+
import { VertexAI, VertexAIErrorCode } from '../public-types';
20+
import { VertexAIService } from '../service';
21+
import { ApiSettings } from '../types/internal';
522

623
/**
724
* Base class for Vertex AI in Firebase model APIs.
@@ -10,7 +27,7 @@ import { ApiSettings } from "../types/internal";
1027
*/
1128
export class VertexAIModel {
1229
/**
13-
* The fully qualified model resource name to use for generating images
30+
* The fully qualified model resource name to use for generating images
1431
* (e.g. `publishers/google/models/imagen-3.0-generate-001`).
1532
*/
1633
readonly model: string;
@@ -22,25 +39,22 @@ export class VertexAIModel {
2239

2340
/**
2441
* Constructs a new instance of the {@link VertexAIModel} class.
25-
*
42+
*
2643
* This constructor should only be called from subclasses that provide
2744
* a model API.
2845
*
2946
* @param vertexAI - An instance of the Vertex AI in Firebase SDK.
3047
* @param modelName - The name of the model being used. It can be in one of the following formats:
3148
* - `my-model` (short name, will resolve to `publishers/google/models/my-model`)
3249
* - `models/my-model` (will resolve to `publishers/google/models/my-model`)
33-
* - `publishers/my-publisher/models/my-model` (fully qualified model name)
34-
*
50+
* - `publishers/my-publisher/models/my-model` (fully qualified model name)
51+
*
3552
* @throws If the `apiKey` or `projectId` fields are missing in your
3653
* Firebase config.
37-
*
54+
*
3855
* @internal
3956
*/
40-
protected constructor(
41-
vertexAI: VertexAI,
42-
modelName: string
43-
) {
57+
protected constructor(vertexAI: VertexAI, modelName: string) {
4458
this.model = VertexAIModel.normalizeModelName(modelName);
4559

4660
if (!vertexAI.app?.options?.apiKey) {
@@ -73,7 +87,7 @@ export class VertexAIModel {
7387

7488
/**
7589
* Normalizes the given model name to a fully qualified model resource name.
76-
*
90+
*
7791
* @param modelName - The model name to normalize.
7892
* @returns The fully qualified model resource name.
7993
*/
@@ -94,4 +108,4 @@ export class VertexAIModel {
94108

95109
return model;
96110
}
97-
}
111+
}

packages/vertexai/src/requests/imagen-image-format.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
/**
219
* Defines the image format for images output by Imagen.
320
*
4-
* Use this class to specify the desired format (JPEG or PNG) and compression quality
5-
* for images generated by Imagen. This is typically included as part of
21+
* Use this class to specify the desired format (JPEG or PNG) and compression quality
22+
* for images generated by Imagen. This is typically included as part of
623
* {@link ImagenModelParams}.
724
*
825
* @example
@@ -26,7 +43,7 @@ export class ImagenImageFormat {
2643
compressionQuality?: number;
2744

2845
private constructor() {
29-
this.mimeType = "image/png";
46+
this.mimeType = 'image/png';
3047
}
3148

3249
/**
@@ -38,7 +55,7 @@ export class ImagenImageFormat {
3855
* @public
3956
*/
4057
static jpeg(compressionQuality: number): ImagenImageFormat {
41-
return { mimeType: "image/jpeg", compressionQuality };
58+
return { mimeType: 'image/jpeg', compressionQuality };
4259
}
4360

4461
/**
@@ -49,6 +66,6 @@ export class ImagenImageFormat {
4966
* @public
5067
*/
5168
static png(): ImagenImageFormat {
52-
return { mimeType: "image/png" };
69+
return { mimeType: 'image/png' };
5370
}
54-
}
71+
}

packages/vertexai/src/requests/request-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
GenerateContentRequest,
2121
Part,
2222
VertexAIErrorCode,
23-
ImagenAspectRatio,
23+
ImagenAspectRatio
2424
} from '../types';
2525
import { VertexAIError } from '../errors';
2626
import { ImagenImageFormat } from './imagen-image-format';

packages/vertexai/src/types/imagen/internal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { ImagenGenerationConfig, ImagenModelConfig } from "./requests";
18+
import { ImagenGenerationConfig, ImagenModelConfig } from './requests';
1919

2020
/**
2121
* A response from the REST API is expected to look like this in the success case:
@@ -130,4 +130,4 @@ export interface ImagenRequestConfig
130130
* (for GCS requests only).
131131
*/
132132
gcsURI?: string;
133-
}
133+
}

0 commit comments

Comments
 (0)