File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/vertexai/src/methods Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,25 @@ export class ChromeAdapter {
141141 }
142142 }
143143
144+ if ( request . systemInstruction ) {
145+ const systemContent = request . systemInstruction as Content ;
146+ // Returns false if the role can't be represented on-device.
147+ if ( systemContent . role && systemContent . role === 'function' ) {
148+ return false ;
149+ }
150+
151+ // Returns false if the system prompt is multi-part.
152+ if ( systemContent . parts && systemContent . parts . length > 1 ) {
153+ return false ;
154+ }
155+
156+ // Returns false if the system prompt isn't text.
157+ const systemText = request . systemInstruction as TextPart ;
158+ if ( ! systemText . text ) {
159+ return false ;
160+ }
161+ }
162+
144163 return true ;
145164 }
146165
You can’t perform that action at this time.
0 commit comments