@@ -17,6 +17,7 @@ import { ApiStream } from "../transform/stream"
1717import { addCacheBreakpoints } from "../transform/caching/vertex"
1818import { getModelParams } from "../transform/model-params"
1919import { filterNonAnthropicBlocks } from "../transform/anthropic-filter"
20+ import { getAnthropicProviderReasoning } from "../transform/reasoning"
2021import {
2122 convertOpenAIToolsToAnthropic ,
2223 convertOpenAIToolChoiceToAnthropic ,
@@ -95,7 +96,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
9596 * This ensures we stay under the 4-block limit while maintaining effective caching
9697 * for the most relevant context.
9798 */
98- const params : Anthropic . Messages . MessageCreateParamsStreaming = {
99+ const params = {
99100 model : id ,
100101 max_tokens : maxTokens ?? ANTHROPIC_DEFAULT_MAX_TOKENS ,
101102 temperature,
@@ -107,7 +108,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
107108 messages : supportsPromptCache ? addCacheBreakpoints ( sanitizedMessages ) : sanitizedMessages ,
108109 stream : true ,
109110 ...nativeToolParams ,
110- }
111+ } as Anthropic . Messages . MessageCreateParamsStreaming
111112
112113 // and prompt caching
113114 const requestOptions = betas ?. length ? { headers : { "anthropic-beta" : betas . join ( "," ) } } : undefined
@@ -240,6 +241,11 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
240241 settings : this . options ,
241242 defaultTemperature : 0 ,
242243 } )
244+ const thinking = getAnthropicProviderReasoning ( {
245+ model : info ,
246+ reasoningBudget : params . reasoningBudget ,
247+ settings : this . options ,
248+ } )
243249
244250 // Build betas array for request headers
245251 const betas : string [ ] = [ ]
@@ -258,6 +264,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
258264 info,
259265 betas : betas . length > 0 ? betas : undefined ,
260266 ...params ,
267+ reasoning : thinking ,
261268 }
262269 }
263270
@@ -271,7 +278,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
271278 reasoning : thinking ,
272279 } = this . getModel ( )
273280
274- const params : Anthropic . Messages . MessageCreateParamsNonStreaming = {
281+ const params = {
275282 model : id ,
276283 max_tokens : maxTokens ,
277284 temperature,
@@ -285,7 +292,7 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
285292 } ,
286293 ] ,
287294 stream : false ,
288- }
295+ } as Anthropic . Messages . MessageCreateParamsNonStreaming
289296
290297 const response = await this . client . messages . create ( params )
291298 const content = response . content [ 0 ]
0 commit comments