Exercises the audio-input branch of MistralClient.IChatClient over the
streaming path:
1. Use Mistral TTS to synthesize a short utterance.
2. Stream a chat completion from VoxtralModels.SmallChat with the audio
bytes attached as a Meai.DataContent with audio/wav media type.
3. Assert that the accumulated Meai.ChatResponseUpdate.Text mentions the
original utterance.
Skips when MISTRAL_API_KEY is unset, the account has no voices, TTS refuses
the request, or the Voxtral chat model isn't enabled for this account.
This example assumes using Mistral; is in scope and apiKey contains your Mistral API key.
usingvarclient=newMistralClient(apiKey);VoiceListResponsevoices;try{voices=awaitclient.AudioVoices.ListAllVoicesAsync();}catch(ApiExceptionex){thrownewAssertInconclusiveException($"Mistral voice listing unavailable (HTTP {(int?)ex.StatusCode}); skipping live streaming chat-with-audio test.",ex);}if(voices.Itemsisnot{Count:>0}items){thrownewAssertInconclusiveException("No voices available on this Mistral account; skipping live streaming chat-with-audio test.");}conststringutterance="The quick brown fox jumps over the lazy dog.";SpeechResponsespeech;try{speech=awaitclient.AudioSpeech.SpeechAsync(newSpeechRequest{Input=utterance,VoiceId=items[0].Id.ToString(),ResponseFormat=SpeechOutputFormat.Wav,});}catch(ApiExceptionex){thrownewAssertInconclusiveException($"Mistral TTS unavailable for this account (HTTP {(int?)ex.StatusCode}); skipping live streaming chat-with-audio test.",ex);}varaudioBytes=Convert.FromBase64String(speech.AudioData);Meai.IChatClientchatClient=client;varupdates=chatClient.GetStreamingResponseAsync([ new Meai.ChatMessage(Meai.ChatRole.User, [ new Meai.TextContent("Repeat exactly what the speaker said in the audio, with no extra commentary."), new Meai.DataContent(audioBytes, mediaType: "audio/wav"), ]),],newMeai.ChatOptions{ModelId=VoxtralChatModelId,});vardeltas=newList<string>();try{awaitforeach(varupdateinupdates){if(!string.IsNullOrEmpty(update.Text)){deltas.Add(update.Text);}}}catch(ApiExceptionex)when(ex.StatusCodeisSystem.Net.HttpStatusCode.NotFoundorSystem.Net.HttpStatusCode.ForbiddenorSystem.Net.HttpStatusCode.BadRequest){thrownewAssertInconclusiveException($"Voxtral chat model '{VoxtralChatModelId}' not enabled for this account (HTTP {(int?)ex.StatusCode}); skipping live streaming chat-with-audio test.",ex);}varcombined=string.Concat(deltas);