File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
packages/vertexai/src/methods Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,9 @@ describe('countTokens()', () => {
6767 ) ;
6868 } ) ;
6969 it ( 'total tokens with modality details' , async ( ) => {
70- const mockResponse = getMockResponse ( 'unary-success-detailed-token-response.json' ) ;
70+ const mockResponse = getMockResponse (
71+ 'unary-success-detailed-token-response.json'
72+ ) ;
7173 const makeRequestStub = stub ( request , 'makeRequest' ) . resolves (
7274 mockResponse as Response
7375 ) ;
Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ describe('generateContent()', () => {
103103 ) ;
104104 } ) ;
105105 it ( 'long response with token details' , async ( ) => {
106- const mockResponse = getMockResponse ( 'unary-success-basic-response-long-usage-metadata.json' ) ;
106+ const mockResponse = getMockResponse (
107+ 'unary-success-basic-response-long-usage-metadata.json'
108+ ) ;
107109 const makeRequestStub = stub ( request , 'makeRequest' ) . resolves (
108110 mockResponse as Response
109111 ) ;
@@ -114,10 +116,18 @@ describe('generateContent()', () => {
114116 ) ;
115117 expect ( result . response . usageMetadata ?. totalTokenCount ) . to . equal ( 1913 ) ;
116118 expect ( result . response . usageMetadata ?. candidatesTokenCount ) . to . equal ( 76 ) ;
117- expect ( result . response . usageMetadata ?. promptTokensDetails ?. [ 0 ] . modality ) . to . equal ( 'IMAGE' ) ;
118- expect ( result . response . usageMetadata ?. promptTokensDetails ?. [ 0 ] . tokenCount ) . to . equal ( 1806 ) ;
119- expect ( result . response . usageMetadata ?. candidatesTokensDetails ?. [ 0 ] . modality ) . to . equal ( 'TEXT' ) ;
120- expect ( result . response . usageMetadata ?. candidatesTokensDetails ?. [ 0 ] . tokenCount ) . to . equal ( 76 ) ;
119+ expect (
120+ result . response . usageMetadata ?. promptTokensDetails ?. [ 0 ] . modality
121+ ) . to . equal ( 'IMAGE' ) ;
122+ expect (
123+ result . response . usageMetadata ?. promptTokensDetails ?. [ 0 ] . tokenCount
124+ ) . to . equal ( 1806 ) ;
125+ expect (
126+ result . response . usageMetadata ?. candidatesTokensDetails ?. [ 0 ] . modality
127+ ) . to . equal ( 'TEXT' ) ;
128+ expect (
129+ result . response . usageMetadata ?. candidatesTokensDetails ?. [ 0 ] . tokenCount
130+ ) . to . equal ( 76 ) ;
121131 expect ( makeRequestStub ) . to . be . calledWith (
122132 'model' ,
123133 Task . GENERATE_CONTENT ,
You can’t perform that action at this time.
0 commit comments