@@ -253,6 +253,30 @@ describe("ChutesHandler", () => {
253253 )
254254 } )
255255
256+ it ( "should return zai-org/GLM-4.6-FP8 model with correct configuration" , ( ) => {
257+ const testModelId : ChutesModelId = "zai-org/GLM-4.6-FP8"
258+ const handlerWithModel = new ChutesHandler ( {
259+ apiModelId : testModelId ,
260+ chutesApiKey : "test-chutes-api-key" ,
261+ } )
262+ const model = handlerWithModel . getModel ( )
263+ expect ( model . id ) . toBe ( testModelId )
264+ expect ( model . info ) . toEqual (
265+ expect . objectContaining ( {
266+ maxTokens : 32768 ,
267+ contextWindow : 204800 ,
268+ supportsImages : false ,
269+ supportsPromptCache : false ,
270+ supportsReasoningEffort : true ,
271+ inputPrice : 0 ,
272+ outputPrice : 0 ,
273+ description :
274+ "GLM-4.6-FP8 model with 200K context window, FP8 precision for efficient inference. Improved reasoning, coding, and agent capabilities." ,
275+ temperature : 0.5 , // Default temperature for non-DeepSeek models
276+ } ) ,
277+ )
278+ } )
279+
256280 it ( "should return Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8 model with correct configuration" , ( ) => {
257281 const testModelId : ChutesModelId = "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8"
258282 const handlerWithModel = new ChutesHandler ( {
@@ -311,6 +335,7 @@ describe("ChutesHandler", () => {
311335 contextWindow : 163840 ,
312336 supportsImages : false ,
313337 supportsPromptCache : false ,
338+ supportsReasoningEffort : true ,
314339 inputPrice : 0 ,
315340 outputPrice : 0 ,
316341 description : "DeepSeek V3.1 Terminus variant - optimized for complex reasoning and extended context." ,
@@ -319,8 +344,8 @@ describe("ChutesHandler", () => {
319344 )
320345 } )
321346
322- it ( "should return DeepSeek V3.1 Turbo model with correct configuration" , ( ) => {
323- const testModelId : ChutesModelId = "deepseek-ai/DeepSeek-V3.1-Turbo "
347+ it ( "should return DeepSeek V3.1 turbo model with correct configuration" , ( ) => {
348+ const testModelId : ChutesModelId = "deepseek-ai/DeepSeek-V3.1-turbo "
324349 const handlerWithModel = new ChutesHandler ( {
325350 apiModelId : testModelId ,
326351 chutesApiKey : "test-chutes-api-key" ,
@@ -333,6 +358,7 @@ describe("ChutesHandler", () => {
333358 contextWindow : 163840 ,
334359 supportsImages : false ,
335360 supportsPromptCache : false ,
361+ supportsReasoningEffort : true ,
336362 inputPrice : 0 ,
337363 outputPrice : 0 ,
338364 description : "DeepSeek V3.1 Turbo variant - faster inference with maintained quality." ,
@@ -515,7 +541,7 @@ describe("ChutesHandler", () => {
515541 expect ( model . info . temperature ) . toBe ( 0.5 )
516542 } )
517543
518- it . skip ( "should enable reasoning for DeepSeek V3.1 models when enableReasoningEffort is true" , async ( ) => {
544+ it ( "should enable reasoning for DeepSeek V3.1 models when enableReasoningEffort is true" , async ( ) => {
519545 const modelId : ChutesModelId = "deepseek-ai/DeepSeek-V3.1"
520546 const handlerWithModel = new ChutesHandler ( {
521547 apiModelId : modelId ,
@@ -525,10 +551,17 @@ describe("ChutesHandler", () => {
525551
526552 mockCreate . mockImplementationOnce ( async ( ) => ( {
527553 [ Symbol . asyncIterator ] : async function * ( ) {
554+ // First yield reasoning content
528555 yield {
529- choices : [ { delta : { content : "<think>Reasoning content</ think>Regular content " } } ] ,
556+ choices : [ { delta : { reasoning_content : "Let me think about this... " } } ] ,
530557 }
558+ // Then yield regular content
531559 yield {
560+ choices : [ { delta : { content : "Here's my response." } } ] ,
561+ }
562+ // Finally yield usage
563+ yield {
564+ choices : [ ] ,
532565 usage : { prompt_tokens : 100 , completion_tokens : 50 } ,
533566 }
534567 } ,
@@ -543,12 +576,22 @@ describe("ChutesHandler", () => {
543576 chunks . push ( chunk )
544577 }
545578
546- // Should parse reasoning content separately
547- expect ( chunks ) . toContainEqual ( { type : "reasoning" , text : "Reasoning content" } )
548- expect ( chunks ) . toContainEqual ( { type : "text" , text : "Regular content" } )
579+ // Should parse reasoning content and regular content separately
580+ expect ( chunks ) . toContainEqual ( { type : "reasoning" , text : "Let me think about this..." } )
581+ expect ( chunks ) . toContainEqual ( { type : "text" , text : "Here's my response." } )
582+ expect ( chunks ) . toContainEqual ( { type : "usage" , inputTokens : 100 , outputTokens : 50 } )
583+
584+ // Verify that the API was called with reasoning enabled
585+ expect ( mockCreate ) . toHaveBeenCalledWith (
586+ expect . objectContaining ( {
587+ chat_template_kwargs : {
588+ thinking : true ,
589+ } ,
590+ } ) ,
591+ )
549592 } )
550593
551- it . skip ( "should enable reasoning for GLM-4.5 models when enableReasoningEffort is true" , async ( ) => {
594+ it ( "should enable reasoning for GLM-4.5 models when enableReasoningEffort is true" , async ( ) => {
552595 const modelId : ChutesModelId = "zai-org/GLM-4.5-Air"
553596 const handlerWithModel = new ChutesHandler ( {
554597 apiModelId : modelId ,
@@ -558,10 +601,17 @@ describe("ChutesHandler", () => {
558601
559602 mockCreate . mockImplementationOnce ( async ( ) => ( {
560603 [ Symbol . asyncIterator ] : async function * ( ) {
604+ // First yield reasoning content
605+ yield {
606+ choices : [ { delta : { reasoning_content : "GLM reasoning process..." } } ] ,
607+ }
608+ // Then yield regular content
561609 yield {
562- choices : [ { delta : { content : "<think>GLM reasoning</think> GLM response" } } ] ,
610+ choices : [ { delta : { content : "GLM response" } } ] ,
563611 }
612+ // Finally yield usage
564613 yield {
614+ choices : [ ] ,
565615 usage : { prompt_tokens : 100 , completion_tokens : 50 } ,
566616 }
567617 } ,
@@ -577,8 +627,17 @@ describe("ChutesHandler", () => {
577627 }
578628
579629 // Should parse reasoning content separately
580- expect ( chunks ) . toContainEqual ( { type : "reasoning" , text : "GLM reasoning" } )
630+ expect ( chunks ) . toContainEqual ( { type : "reasoning" , text : "GLM reasoning process... " } )
581631 expect ( chunks ) . toContainEqual ( { type : "text" , text : "GLM response" } )
632+
633+ // Verify that the API was called with reasoning enabled
634+ expect ( mockCreate ) . toHaveBeenCalledWith (
635+ expect . objectContaining ( {
636+ chat_template_kwargs : {
637+ thinking : true ,
638+ } ,
639+ } ) ,
640+ )
582641 } )
583642
584643 it . skip ( "should disable reasoning for DeepSeek V3.1 models when enableReasoningEffort is false" , async ( ) => {
@@ -595,6 +654,7 @@ describe("ChutesHandler", () => {
595654 choices : [ { delta : { content : "<think>Reasoning content</think>Regular content" } } ] ,
596655 }
597656 yield {
657+ choices : [ ] ,
598658 usage : { prompt_tokens : 100 , completion_tokens : 50 } ,
599659 }
600660 } ,
0 commit comments