File tree Expand file tree Collapse file tree 2 files changed +1
-57
lines changed
packages/vertexai/src/methods Expand file tree Collapse file tree 2 files changed +1
-57
lines changed Original file line number Diff line number Diff line change @@ -108,42 +108,6 @@ describe('ChromeAdapter', () => {
108108 } )
109109 ) . to . be . false ;
110110 } ) ;
111- it ( 'returns false if request system instruction has function role' , async ( ) => {
112- const adapter = new ChromeAdapter ( { } as AI , 'prefer_on_device' ) ;
113- expect (
114- await adapter . isAvailable ( {
115- contents : [ ] ,
116- systemInstruction : {
117- role : 'function' ,
118- parts : [ ]
119- }
120- } )
121- ) . to . be . false ;
122- } ) ;
123- it ( 'returns false if request system instruction has multiple parts' , async ( ) => {
124- const adapter = new ChromeAdapter ( { } as AI , 'prefer_on_device' ) ;
125- expect (
126- await adapter . isAvailable ( {
127- contents : [ ] ,
128- systemInstruction : {
129- role : 'function' ,
130- parts : [ { text : 'a' } , { text : 'b' } ]
131- }
132- } )
133- ) . to . be . false ;
134- } ) ;
135- it ( 'returns false if request system instruction has non-text part' , async ( ) => {
136- const adapter = new ChromeAdapter ( { } as AI , 'prefer_on_device' ) ;
137- expect (
138- await adapter . isAvailable ( {
139- contents : [ ] ,
140- systemInstruction : {
141- role : 'function' ,
142- parts : [ { inlineData : { mimeType : 'a' , data : 'b' } } ]
143- }
144- } )
145- ) . to . be . false ;
146- } ) ;
147111 it ( 'returns true if model is readily available' , async ( ) => {
148112 const aiProvider = {
149113 languageModel : {
Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ import {
2121 EnhancedGenerateContentResponse ,
2222 GenerateContentRequest ,
2323 InferenceMode ,
24- Role ,
25- TextPart
24+ Role
2625} from '../types' ;
2726
2827/**
@@ -111,25 +110,6 @@ export class ChromeAdapter {
111110 }
112111 }
113112
114- if ( request . systemInstruction ) {
115- const systemContent = request . systemInstruction as Content ;
116- // Returns false if the role can't be represented on-device.
117- if ( systemContent . role && systemContent . role === 'function' ) {
118- return false ;
119- }
120-
121- // Returns false if the system prompt is multi-part.
122- if ( systemContent . parts && systemContent . parts . length > 1 ) {
123- return false ;
124- }
125-
126- // Returns false if the system prompt isn't text.
127- const systemText = request . systemInstruction as TextPart ;
128- if ( ! systemText . text ) {
129- return false ;
130- }
131- }
132-
133113 return true ;
134114 }
135115 private async availability ( ) : Promise < AICapabilityAvailability | undefined > {
You can’t perform that action at this time.
0 commit comments