@@ -91,6 +91,44 @@ public async Task SemanticKernelExtensionAddsChatService()
9191 Assert . Contains ( "mlx" , result [ 0 ] . Content , StringComparison . OrdinalIgnoreCase ) ;
9292 }
9393
94+ [ Fact ( Skip = "Requires real MLX model and native library" ) ]
95+ public async Task RealModelGeneratesText ( )
96+ {
97+ var modelPath = Environment . GetEnvironmentVariable ( "MLXSHARP_MODEL_PATH" ) ;
98+ if ( string . IsNullOrEmpty ( modelPath ) || ! Directory . Exists ( modelPath ) )
99+ {
100+ // Skip if model not available
101+ return ;
102+ }
103+
104+ var services = new ServiceCollection ( ) ;
105+ services . AddMlx ( builder =>
106+ {
107+ builder . Configure ( options =>
108+ {
109+ options . ChatModelId = modelPath ;
110+ options . LibraryPath = ResolveNativeLibraryPath ( ) ;
111+ } ) ;
112+ builder . UseNativeBackend ( ) ;
113+ } ) ;
114+
115+ await using var provider = services . BuildServiceProvider ( ) ;
116+ var chatClient = provider . GetRequiredService < IChatClient > ( ) ;
117+
118+ var response = await chatClient . GetResponseAsync (
119+ new [ ] { new ChatMessage ( ChatRole . User , "Say hello in Ukrainian" ) } ,
120+ new ChatOptions { MaxOutputTokens = 50 } ,
121+ CancellationToken . None ) ;
122+
123+ Assert . NotEmpty ( response . Messages ) ;
124+ Assert . NotEmpty ( response . Messages [ 0 ] . Text ) ;
125+ // Should contain Ukrainian greeting
126+ Assert . True ( response . Messages [ 0 ] . Text . Contains ( "Привіт" , StringComparison . OrdinalIgnoreCase ) ||
127+ response . Messages [ 0 ] . Text . Contains ( "Вітаю" , StringComparison . OrdinalIgnoreCase ) ||
128+ response . Messages [ 0 ] . Text . Contains ( "Здрастуйте" , StringComparison . OrdinalIgnoreCase ) ,
129+ $ "Expected Ukrainian greeting but got: { response . Messages [ 0 ] . Text } ") ;
130+ }
131+
94132 private static string ? ResolveNativeLibraryPath ( )
95133 {
96134 var baseDirectory = AppContext . BaseDirectory ;
0 commit comments