File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
packages/vertexai/src/requests Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,11 @@ export function formatNewContent(
5050 if ( typeof request === 'string' ) {
5151 newParts = [ { text : request } ] ;
5252 } else {
53- for ( const elem of request ) {
54- if ( typeof elem === 'string' ) {
55- newParts . push ( { text : elem } ) ;
53+ for ( const partOrString of request ) {
54+ if ( typeof partOrString === 'string' ) {
55+ newParts . push ( { text : partOrString } ) ;
5656 } else {
57- newParts . push ( elem ) ;
57+ newParts . push ( partOrString ) ;
5858 }
5959 }
6060 }
@@ -114,6 +114,7 @@ export function formatGenerateContentInput(
114114 if ( ( params as GenerateContentRequest ) . contents ) {
115115 formattedRequest = params as GenerateContentRequest ;
116116 } else {
117+ // Array or string
117118 const content = formatNewContent ( params as string | Array < string | Part > ) ;
118119 formattedRequest = { contents : [ content ] } ;
119120 }
Original file line number Diff line number Diff line change @@ -207,7 +207,6 @@ export function formatBlockErrorMessage(
207207 *
208208 * @internal
209209 */
210-
211210export async function handlePredictResponse <
212211 T extends ImagenInlineImage | ImagenGCSImage
213212> ( response : Response ) : Promise < { images : T [ ] ; filteredReason ?: string } > {
You can’t perform that action at this time.
0 commit comments