Microsoft.Extensions.AI -- AIFunction tools for use with any IChatClient
Emotion Analysis
Submit text for batch emotion analysis using the Expression Measurement API.
1 2 3 4 5 6 7 8 9101112131415
// Create an authenticated clientusingvarclient=newHumeAIClient(apiKey);// Start a batch inference job with text analysisvarjobResult=awaitclient.Batch.StartBatchInferenceJobAsync(request:newInferenceBaseRequest{Text=["I am so happy to see you! This is wonderful news."],Models=newModelsConfig{Language=newLanguageModelConfig(),},});// The job ID can be used to check status and retrieve predictions
Text-to-Speech
Synthesize speech from text using the Hume TTS API.
1 2 3 4 5 6 7 8 9101112131415161718
// Create an authenticated clientusingvarclient=newHumeAIClient(apiKey);// Synthesize speech from textvarresult=awaitclient.Tts.SynthesizeJsonAsync(request:newPostedTts{Utterances=[ new PostedUtterance { Text = "Hello! I am excited to demonstrate Hume's text-to-speech capabilities.", Speed = 1.0, }, ],});// The result contains generation metadata and audio data
MEAI Tools
Use AIFunction tools with Microsoft.Extensions.AI for integration with any IChatClient.
1 2 3 4 5 6 7 8 9101112
// Create an authenticated clientusingvarclient=newHumeAIClient(apiKey);// Create AIFunction tools for use with any IChatClientvarstartJobTool=client.AsStartBatchJobTool();vargetStatusTool=client.AsGetJobStatusTool();varlistJobsTool=client.AsListJobsTool();varsynthesizeTool=client.AsSynthesizeSpeechTool();varlistVoicesTool=client.AsListVoicesTool();varlistChatsTool=client.AsListChatsTool();// Verify tools are created with proper metadata