@@ -528,4 +528,40 @@ describe("ChutesHandler", () => {
528528 expect ( model . inputPrice ) . toBe ( 1.15 )
529529 expect ( model . outputPrice ) . toBe ( 3.25 )
530530 } )
531+
532+ it ( "createMessage should pass correct parameters to Chutes client for GLM-4.6-turbo model" , async ( ) => {
533+ const modelId : ChutesModelId = "zai-org/GLM-4.6-turbo"
534+ const modelInfo = chutesModels [ modelId ]
535+ const handlerWithModel = new ChutesHandler ( { apiModelId : modelId , chutesApiKey : "test-chutes-api-key" } )
536+
537+ mockCreate . mockImplementationOnce ( ( ) => {
538+ return {
539+ [ Symbol . asyncIterator ] : ( ) => ( {
540+ async next ( ) {
541+ return { done : true }
542+ } ,
543+ } ) ,
544+ }
545+ } )
546+
547+ const systemPrompt = "Test system prompt for GLM-4.6-turbo"
548+ const messages : Anthropic . Messages . MessageParam [ ] = [
549+ { role : "user" , content : "Test message for GLM-4.6-turbo" } ,
550+ ]
551+
552+ const messageGenerator = handlerWithModel . createMessage ( systemPrompt , messages )
553+ await messageGenerator . next ( )
554+
555+ expect ( mockCreate ) . toHaveBeenCalledWith (
556+ expect . objectContaining ( {
557+ model : modelId ,
558+ max_tokens : modelInfo . maxTokens , // Should be 32768
559+ temperature : 0.5 , // Default temperature for non-DeepSeek models
560+ messages : expect . arrayContaining ( [ { role : "system" , content : systemPrompt } ] ) ,
561+ stream : true ,
562+ stream_options : { include_usage : true } ,
563+ } ) ,
564+ undefined ,
565+ )
566+ } )
531567} )
0 commit comments