@@ -137,7 +137,7 @@ describe("DeepSeekHandler", () => {
137137 beforeEach ( ( ) => {
138138 mockOptions = {
139139 deepSeekApiKey : "test-api-key" ,
140- apiModelId : "deepseek-chat " ,
140+ apiModelId : "deepseek-v4-flash " ,
141141 deepSeekBaseUrl : "https://api.deepseek.com" ,
142142 }
143143 handler = new DeepSeekHandler ( mockOptions )
@@ -208,11 +208,11 @@ describe("DeepSeekHandler", () => {
208208 const model = handler . getModel ( )
209209 expect ( model . id ) . toBe ( mockOptions . apiModelId )
210210 expect ( model . info ) . toBeDefined ( )
211- expect ( model . info . maxTokens ) . toBe ( 8192 ) // deepseek-chat legacy alias has 8K max
212- expect ( model . info . contextWindow ) . toBe ( 128_000 )
213- expect ( model . info . supportsImages ) . toBe ( false )
211+ expect ( model . info . maxTokens ) . toBe ( 384_000 )
212+ expect ( model . info . contextWindow ) . toBe ( 1_000_000 )
213+ expect ( model . info . supportsImages ) . toBe ( true )
214214 expect ( model . info . supportsPromptCache ) . toBe ( true ) // Should be true now
215- expect ( ( model . info as ModelInfo ) . preserveReasoning ) . toBeUndefined ( )
215+ expect ( ( model . info as ModelInfo ) . preserveReasoning ) . toBe ( true )
216216 } )
217217
218218 it ( "should use deepseek-v4-flash as the default model ID for new configs" , ( ) => {
@@ -226,21 +226,7 @@ describe("DeepSeekHandler", () => {
226226 expect ( model . info . maxTokens ) . toBe ( 384_000 )
227227 expect ( model . info . contextWindow ) . toBe ( 1_000_000 )
228228 expect ( model . info . supportsImages ) . toBe ( true )
229- expect ( ( model . info as ModelInfo ) . supportsReasoningEffort ) . toContain ( "xhigh" )
230- } )
231-
232- it ( "should return correct model info for deepseek-reasoner" , ( ) => {
233- const handlerWithReasoner = new DeepSeekHandler ( {
234- ...mockOptions ,
235- apiModelId : "deepseek-reasoner" ,
236- } )
237- const model = handlerWithReasoner . getModel ( )
238- expect ( model . id ) . toBe ( "deepseek-reasoner" )
239- expect ( model . info ) . toBeDefined ( )
240- expect ( model . info . maxTokens ) . toBe ( 8192 ) // deepseek-reasoner has 8K max
241- expect ( model . info . contextWindow ) . toBe ( 128_000 )
242- expect ( model . info . supportsImages ) . toBe ( false )
243- expect ( model . info . supportsPromptCache ) . toBe ( true )
229+ expect ( ( model . info as ModelInfo ) . supportsReasoningEffort ) . toContain ( "max" )
244230 } )
245231
246232 it ( "should return correct model info for deepseek-v4-pro" , ( ) => {
@@ -259,31 +245,6 @@ describe("DeepSeekHandler", () => {
259245 expect ( ( model . info as ModelInfo ) . reasoningEffort ) . toBe ( "high" )
260246 } )
261247
262- it ( "should have preserveReasoning enabled for deepseek-reasoner to support interleaved thinking" , ( ) => {
263- // This is critical for DeepSeek's interleaved thinking mode with tool calls.
264- // See: https://api-docs.deepseek.com/guides/thinking_mode
265- // The reasoning_content needs to be passed back during tool call continuation
266- // within the same turn for the model to continue reasoning properly.
267- const handlerWithReasoner = new DeepSeekHandler ( {
268- ...mockOptions ,
269- apiModelId : "deepseek-reasoner" ,
270- } )
271- const model = handlerWithReasoner . getModel ( )
272- // Cast to ModelInfo to access preserveReasoning which is an optional property
273- expect ( ( model . info as ModelInfo ) . preserveReasoning ) . toBe ( true )
274- } )
275-
276- it ( "should NOT have preserveReasoning enabled for deepseek-chat" , ( ) => {
277- // deepseek-chat doesn't use thinking mode, so no need to preserve reasoning
278- const chatHandler = new DeepSeekHandler ( {
279- ...mockOptions ,
280- apiModelId : "deepseek-chat" ,
281- } )
282- const model = chatHandler . getModel ( )
283- // Cast to ModelInfo to access preserveReasoning which is an optional property
284- expect ( ( model . info as ModelInfo ) . preserveReasoning ) . toBeUndefined ( )
285- } )
286-
287248 it ( "should return provided model ID with default model info if model does not exist" , ( ) => {
288249 const handlerWithInvalidModel = new DeepSeekHandler ( {
289250 ...mockOptions ,
@@ -540,10 +501,10 @@ describe("DeepSeekHandler", () => {
540501 } ,
541502 ]
542503
543- it ( "should handle reasoning_content in streaming responses for deepseek-reasoner " , async ( ) => {
504+ it ( "should handle reasoning_content in streaming responses for deepseek-v4-pro " , async ( ) => {
544505 const reasonerHandler = new DeepSeekHandler ( {
545506 ...mockOptions ,
546- apiModelId : "deepseek-reasoner " ,
507+ apiModelId : "deepseek-v4-pro " ,
547508 } )
548509
549510 const stream = reasonerHandler . createMessage ( systemPrompt , messages )
@@ -559,10 +520,10 @@ describe("DeepSeekHandler", () => {
559520 expect ( reasoningChunks [ 1 ] . text ) . toBe ( " I'll analyze step by step." )
560521 } )
561522
562- it ( "should pass thinking parameter for deepseek-reasoner model" , async ( ) => {
523+ it ( "should pass thinking parameter for deepseek-v4-pro model" , async ( ) => {
563524 const reasonerHandler = new DeepSeekHandler ( {
564525 ...mockOptions ,
565- apiModelId : "deepseek-reasoner " ,
526+ apiModelId : "deepseek-v4-pro " ,
566527 } )
567528
568529 const stream = reasonerHandler . createMessage ( systemPrompt , messages )
@@ -579,7 +540,7 @@ describe("DeepSeekHandler", () => {
579540 { } , // Empty path options for non-Azure URLs
580541 )
581542 const callArgs = mockCreate . mock . calls [ 0 ] [ 0 ]
582- expect ( callArgs . reasoning_effort ) . toBeUndefined ( )
543+ expect ( callArgs . reasoning_effort ) . toBe ( "high" )
583544 } )
584545
585546 it ( "should enable thinking by default for deepseek-v4-flash" , async ( ) => {
@@ -619,27 +580,6 @@ describe("DeepSeekHandler", () => {
619580 expect ( callArgs . max_completion_tokens ) . toBe ( 32_000 )
620581 } )
621582
622- it ( "should map xhigh reasoning effort to DeepSeek max effort" , async ( ) => {
623- const v4Handler = new DeepSeekHandler ( {
624- ...mockOptions ,
625- apiModelId : "deepseek-v4-pro" ,
626- reasoningEffort : "xhigh" ,
627- } )
628-
629- const stream = v4Handler . createMessage ( systemPrompt , messages )
630- for await ( const _chunk of stream ) {
631- // Consume the stream
632- }
633-
634- expect ( mockCreate ) . toHaveBeenCalledWith (
635- expect . objectContaining ( {
636- thinking : { type : "enabled" } ,
637- reasoning_effort : "max" ,
638- } ) ,
639- { } ,
640- )
641- } )
642-
643583 it ( "should disable thinking for deepseek-v4 models when reasoning is disabled" , async ( ) => {
644584 const v4Handler = new DeepSeekHandler ( {
645585 ...mockOptions ,
@@ -674,26 +614,10 @@ describe("DeepSeekHandler", () => {
674614 expect ( callArgs . temperature ) . toBe ( DEEP_SEEK_DEFAULT_TEMPERATURE )
675615 } )
676616
677- it ( "should NOT pass thinking parameter for deepseek-chat model" , async ( ) => {
678- const chatHandler = new DeepSeekHandler ( {
679- ...mockOptions ,
680- apiModelId : "deepseek-chat" ,
681- } )
682-
683- const stream = chatHandler . createMessage ( systemPrompt , messages )
684- for await ( const _chunk of stream ) {
685- // Consume the stream
686- }
687-
688- // Verify that the thinking parameter was NOT passed to the API
689- const callArgs = mockCreate . mock . calls [ 0 ] [ 0 ]
690- expect ( callArgs . thinking ) . toBeUndefined ( )
691- } )
692-
693617 it ( "should handle tool calls with reasoning_content" , async ( ) => {
694618 const reasonerHandler = new DeepSeekHandler ( {
695619 ...mockOptions ,
696- apiModelId : "deepseek-reasoner " ,
620+ apiModelId : "deepseek-v4-pro " ,
697621 } )
698622
699623 const tools : any [ ] = [
0 commit comments