Skip to content

Commit 20a7195

Browse files
erikeldridgegsiddh
authored andcommitted
Use the existing name of the model params input
1 parent 8b15e88 commit 20a7195

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/vertexai/src/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ export function getVertexAI(
7171
*/
7272
export function getGenerativeModel(
7373
vertexAI: VertexAI,
74-
onCloudOrHybridParams: ModelParams | HybridParams,
74+
modelParams: ModelParams | HybridParams,
7575
requestOptions?: RequestOptions
7676
): GenerativeModel {
77-
// Disambiguates onCloudOrHybridParams input.
78-
const hybridParams = onCloudOrHybridParams as HybridParams;
77+
// Uses the existence of HybridParams.mode to clarify the type of the modelParams input.
78+
const hybridParams = modelParams as HybridParams;
7979
let onCloudParams: ModelParams;
8080
if (hybridParams.mode) {
8181
onCloudParams = hybridParams.onCloudParams || {
8282
model: 'gemini-2.0-flash-lite'
8383
};
8484
} else {
85-
onCloudParams = onCloudOrHybridParams as ModelParams;
85+
onCloudParams = modelParams as ModelParams;
8686
}
8787

8888
if (!onCloudParams.model) {

0 commit comments

Comments
 (0)