@@ -143,7 +143,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
143143 for await ( const chunk of stream ) {
144144 switch ( chunk . type ) {
145145 case "message_start" : {
146- const usage = chunk . message ! . usage
146+ const usage = chunk . message . usage
147147
148148 // `output_tokens_details.thinking_tokens` decomposes the billed
149149 // output into internal reasoning tokens; surfaced for per-turn
@@ -155,19 +155,19 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
155155 cacheWriteTokens : usage . cache_creation_input_tokens || undefined ,
156156 cacheReadTokens : usage . cache_read_input_tokens || undefined ,
157157 ...( typeof usage . output_tokens_details ?. thinking_tokens === "number"
158- ? { reasoningTokens : usage . output_tokens_details ! . thinking_tokens }
158+ ? { reasoningTokens : usage . output_tokens_details . thinking_tokens }
159159 : { } ) ,
160160 }
161161
162162 break
163163 }
164164 case "message_delta" : {
165- const deltaThinkingTokens = chunk . usage ! . output_tokens_details ?. thinking_tokens
165+ const deltaThinkingTokens = chunk . usage . output_tokens_details ?. thinking_tokens
166166
167167 yield {
168168 type : "usage" ,
169169 inputTokens : 0 ,
170- outputTokens : chunk . usage ! . output_tokens || 0 ,
170+ outputTokens : chunk . usage . output_tokens || 0 ,
171171 ...( typeof deltaThinkingTokens === "number"
172172 ? { reasoningTokens : deltaThinkingTokens }
173173 : { } ) ,
@@ -176,17 +176,17 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
176176 break
177177 }
178178 case "content_block_start" : {
179- switch ( chunk . content_block ! . type ) {
179+ switch ( chunk . content_block . type ) {
180180 case "text" : {
181- if ( chunk . index ! > 0 ) {
181+ if ( chunk . index > 0 ) {
182182 yield { type : "text" , text : "\n" }
183183 }
184184
185- yield { type : "text" , text : chunk . content_block ! . text }
185+ yield { type : "text" , text : chunk . content_block . text }
186186 break
187187 }
188188 case "thinking" : {
189- if ( chunk . index ! > 0 ) {
189+ if ( chunk . index > 0 ) {
190190 yield { type : "reasoning" , text : "\n" }
191191 }
192192
@@ -198,8 +198,8 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
198198 yield {
199199 type : "tool_call_partial" ,
200200 index : chunk . index ,
201- id : chunk . content_block ! . id ,
202- name : chunk . content_block ! . name ,
201+ id : chunk . content_block . id ,
202+ name : chunk . content_block . name ,
203203 arguments : undefined ,
204204 }
205205 break
@@ -209,9 +209,9 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
209209 break
210210 }
211211 case "content_block_delta" : {
212- switch ( chunk . delta ! . type ) {
212+ switch ( chunk . delta . type ) {
213213 case "text_delta" : {
214- yield { type : "text" , text : chunk . delta ! . text }
214+ yield { type : "text" , text : chunk . delta . text }
215215 break
216216 }
217217 case "thinking_delta" : {
0 commit comments