File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed
Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
2222} from '../types' ;
2323import { Task , makeRequest } from '../requests/request' ;
2424import { 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' ;
2626import { BackendType } from '../public-types' ;
2727
2828export async function countTokens (
Original file line number Diff line number Diff 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 */
2929export type VertexAI = GenAI ;
3030
3131/**
3232 * Options when initializing the Vertex AI in Firebase SDK.
33- *
33+ *
3434 * @public
3535 */
3636export interface VertexAIOptions {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments