File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -2597,6 +2597,7 @@ export class GenerateContentResponse {
25972597 if (
25982598 fieldName !== 'text' &&
25992599 fieldName !== 'thought' &&
2600+ fieldName !== 'thoughtSignature' &&
26002601 ( fieldValue !== null || fieldValue !== undefined )
26012602 ) {
26022603 nonTextParts . push ( fieldName ) ;
Original file line number Diff line number Diff line change @@ -117,8 +117,39 @@ describe('GenerateContentResponse.text', () => {
117117 } ,
118118 } as Candidate ,
119119 ] ;
120+
120121 expect ( response . text ) . toBe ( 'Hello ' ) ;
121122 } ) ;
123+
124+ it ( 'should not warn when thought_signature is present' , ( ) => {
125+ const response = new GenerateContentResponse ( ) ;
126+ response . candidates = [
127+ {
128+ content : {
129+ parts : [ { text : 'Hello ' } , { thoughtSignature : 'thought' } ] ,
130+ } ,
131+ } as Candidate ,
132+ ] ;
133+ spyOn ( console , 'warn' ) ;
134+
135+ expect ( response . text ) . toEqual ( 'Hello ' ) ;
136+ expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
137+ } ) ;
138+
139+ it ( 'should not warn when thought_signature is present in a text part' , ( ) => {
140+ const response = new GenerateContentResponse ( ) ;
141+ response . candidates = [
142+ {
143+ content : {
144+ parts : [ { text : 'Hello ' , thoughtSignature : 'thought' } ] ,
145+ } ,
146+ } as Candidate ,
147+ ] ;
148+ spyOn ( console , 'warn' ) ;
149+
150+ expect ( response . text ) . toEqual ( 'Hello ' ) ;
151+ expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
152+ } ) ;
122153} ) ;
123154
124155describe ( 'GenerateContentResponse.data' , ( ) => {
You can’t perform that action at this time.
0 commit comments