Skip to content

Commit bd7bd2a

Browse files
committed
formatting
1 parent 2c66e92 commit bd7bd2a

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

packages/vertexai/src/methods/count-tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from '../types';
2323
import { Task, makeRequest } from '../requests/request';
2424
import { ApiSettings } from '../types/internal';
25-
import * as GoogleAIMapper from '../googleAIMappers'; // FIXME: (code smell) Is there a better way to namespace this?
25+
import * as GoogleAIMapper from '../googleAIMappers';
2626
import { BackendType } from '../public-types';
2727

2828
export async function countTokens(

packages/vertexai/src/public-types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ export * from './types';
2121

2222
/**
2323
* An instance of the Vertex AI in Firebase SDK.
24-
*
24+
*
2525
* For more information, refer to the documentation for the new {@link GenAI}.
26-
*
26+
*
2727
* @public
2828
*/
2929
export type VertexAI = GenAI;
3030

3131
/**
3232
* Options when initializing the Vertex AI in Firebase SDK.
33-
*
33+
*
3434
* @public
3535
*/
3636
export interface VertexAIOptions {

packages/vertexai/src/requests/stream-reader.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,17 @@ async function* generateResponseSequence(
8989
break;
9090
}
9191

92-
const enhancedResponse =
93-
apiSettings.backend.backendType === BackendType.GOOGLE_AI
94-
? createEnhancedContentResponse(
95-
GoogleAIMapper.mapGenerateContentResponse(
96-
value as GoogleAIGenerateContentResponse
97-
)
98-
)
99-
: createEnhancedContentResponse(value);
92+
let enhancedResponse: EnhancedGenerateContentResponse;
93+
if (apiSettings.backend.backendType === BackendType.GOOGLE_AI) {
94+
enhancedResponse = createEnhancedContentResponse(
95+
GoogleAIMapper.mapGenerateContentResponse(
96+
value as GoogleAIGenerateContentResponse
97+
)
98+
);
99+
} else {
100+
enhancedResponse = createEnhancedContentResponse(value);
101+
}
102+
100103
yield enhancedResponse;
101104
}
102105
}

0 commit comments

Comments
 (0)