@@ -59,49 +59,52 @@ function runWrappedXiaomiStream(params: {
5959}
6060
6161describe ( "xiaomi provider plugin" , ( ) => {
62- it ( "normalizes reasoning-only final assistant messages into text for MiMo reasoning models" , async ( ) => {
63- const stream = runWrappedXiaomiStream ( {
64- modelId : "mimo-v2-pro" ,
65- events : [
62+ it . each ( [ "mimo-v2-pro" , "mimo-v2-omni" ] ) (
63+ "normalizes reasoning-only final assistant messages into text for %s" ,
64+ async ( modelId ) => {
65+ const stream = runWrappedXiaomiStream ( {
66+ modelId,
67+ events : [
68+ {
69+ type : "done" ,
70+ reason : "stop" ,
71+ message : {
72+ role : "assistant" ,
73+ content : [ { type : "thinking" , thinking : "MiMo final answer" } ] ,
74+ stopReason : "stop" ,
75+ } ,
76+ } ,
77+ ] ,
78+ resultMessage : {
79+ role : "assistant" ,
80+ content : [ { type : "thinking" , thinking : "MiMo final answer" } ] ,
81+ stopReason : "stop" ,
82+ } ,
83+ } ) ;
84+
85+ const events : unknown [ ] = [ ] ;
86+ for await ( const event of stream ) {
87+ events . push ( event ) ;
88+ }
89+
90+ await expect ( stream . result ( ) ) . resolves . toEqual ( {
91+ role : "assistant" ,
92+ content : [ { type : "text" , text : "MiMo final answer" } ] ,
93+ stopReason : "stop" ,
94+ } ) ;
95+ expect ( events ) . toEqual ( [
6696 {
6797 type : "done" ,
6898 reason : "stop" ,
6999 message : {
70100 role : "assistant" ,
71- content : [ { type : "thinking " , thinking : "MiMo final answer" } ] ,
101+ content : [ { type : "text " , text : "MiMo final answer" } ] ,
72102 stopReason : "stop" ,
73103 } ,
74104 } ,
75- ] ,
76- resultMessage : {
77- role : "assistant" ,
78- content : [ { type : "thinking" , thinking : "MiMo final answer" } ] ,
79- stopReason : "stop" ,
80- } ,
81- } ) ;
82-
83- const events : unknown [ ] = [ ] ;
84- for await ( const event of stream ) {
85- events . push ( event ) ;
86- }
87-
88- await expect ( stream . result ( ) ) . resolves . toEqual ( {
89- role : "assistant" ,
90- content : [ { type : "text" , text : "MiMo final answer" } ] ,
91- stopReason : "stop" ,
92- } ) ;
93- expect ( events ) . toEqual ( [
94- {
95- type : "done" ,
96- reason : "stop" ,
97- message : {
98- role : "assistant" ,
99- content : [ { type : "text" , text : "MiMo final answer" } ] ,
100- stopReason : "stop" ,
101- } ,
102- } ,
103- ] ) ;
104- } ) ;
105+ ] ) ;
106+ } ,
107+ ) ;
105108
106109 it ( "leaves non-target Xiaomi models unchanged" , async ( ) => {
107110 const stream = runWrappedXiaomiStream ( {
0 commit comments