Skip to content

Commit 48fc75c

Browse files
committed
Format
1 parent ff62500 commit 48fc75c

File tree

5 files changed

+74
-13
lines changed

5 files changed

+74
-13
lines changed

packages/vertexai/src/backend.test.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
import { expect } from "chai";
2-
import { GoogleAIBackend, VertexAIBackend } from "./backend";
3-
import { BackendType } from "./public-types";
4-
import { DEFAULT_LOCATION } from "./constants";
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 { expect } from 'chai';
19+
import { GoogleAIBackend, VertexAIBackend } from './backend';
20+
import { BackendType } from './public-types';
21+
import { DEFAULT_LOCATION } from './constants';
522

623
describe('Backend', () => {
724
describe('GoogleAIBackend', () => {
8-
it('sets backendType to GOOGLE_AI', () => {
25+
it('sets backendType to GOOGLE_AI', () => {
926
const backend = new GoogleAIBackend();
1027
expect(backend.backendType).to.equal(BackendType.GOOGLE_AI);
1128
});
@@ -32,4 +49,4 @@ describe('Backend', () => {
3249
expect(backend.location).to.equal(DEFAULT_LOCATION);
3350
});
3451
});
35-
});
52+
});

packages/vertexai/src/backend.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1-
import { DEFAULT_LOCATION } from "./constants";
2-
import { BackendType } from "./public-types";
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 { DEFAULT_LOCATION } from './constants';
19+
import { BackendType } from './public-types';
320

421
/**
522
* Abstract base class representing the configuration for an AI service backend.
@@ -69,4 +86,4 @@ export class VertexAIBackend extends Backend {
6986
this.location = location;
7087
}
7188
}
72-
}
89+
}

packages/vertexai/src/googleai-mappers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ export function mapGenerateContentCandidates(
164164
mappedSafetyRatings = candidate.safetyRatings.map(safetyRating => {
165165
return {
166166
...safetyRating,
167-
severity: safetyRating.severity ?? HarmSeverity.HARM_SEVERITY_UNSUPPORTED,
167+
severity:
168+
safetyRating.severity ?? HarmSeverity.HARM_SEVERITY_UNSUPPORTED,
168169
probabilityScore: safetyRating.probabilityScore ?? 0,
169170
severityScore: safetyRating.severityScore ?? 0
170171
};

packages/vertexai/src/types/googleai.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
import { Tool, GenerationConfig, Citation, FinishReason, GroundingMetadata, PromptFeedback, SafetyRating, UsageMetadata } from '../public-types';
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 {
19+
Tool,
20+
GenerationConfig,
21+
Citation,
22+
FinishReason,
23+
GroundingMetadata,
24+
PromptFeedback,
25+
SafetyRating,
26+
UsageMetadata
27+
} from '../public-types';
228
import { Content, Part } from './content';
329

430
/**
@@ -41,4 +67,4 @@ export interface GoogleAIGenerateContentCandidate {
4167
*/
4268
export interface GoogleAICitationMetadata {
4369
citationSources: Citation[]; // Maps to `citations`
44-
}
70+
}

packages/vertexai/src/types/responses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export interface CountTokensResponse {
249249
/**
250250
* The total number of billable characters counted across all instances
251251
* from the request.
252-
*
252+
*
253253
* This field is not supported in Google AI, so it will default to 0 when using Google AI.
254254
*/
255255
totalBillableCharacters?: number;

0 commit comments

Comments
 (0)