Skip to content

MeaiTools

This example assumes using LalalAI; is in scope and apiKey contains your LalalAI API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
var apiKey =
    Environment.GetEnvironmentVariable("LALALAI_API_KEY") is { Length: > 0 } value
        ? value
        : throw new AssertInconclusiveException("LALALAI_API_KEY environment variable is not found.");

using var client = new LalalAIClient(apiKey);

// Create tools for checking task status, remaining minutes, voice packs, and task cancellation.
var checkTaskStatusTool = client.AsCheckTaskStatusTool();
var getMinutesLeftTool = client.AsGetMinutesLeftTool();
var listVoicePacksTool = client.AsListVoicePacksTool();
var cancelTasksTool = client.AsCancelTasksTool();

// These tools can be passed to any IChatClient that supports function calling.
var tools = new[] { checkTaskStatusTool, getMinutesLeftTool, listVoicePacksTool, cancelTasksTool };