Example showing how to create MEAI AIFunction tools from the Topaz client.
This example assumes using Topaz; is in scope and apiKey contains your Topaz API key.
1 2 3 4 5 6 7 8 910111213141516171819202122
// Create AIFunction tools from the Topaz client for use with any `IChatClient`.varapiKey=Environment.GetEnvironmentVariable("TOPAZ_API_KEY")is{Length:>0}apiKeyValue?apiKeyValue:thrownewAssertInconclusiveException("TOPAZ_API_KEY environment variable is not found.");usingvarclient=newTopazClient(apiKey);// Create tools that wrap the core async-job workflow:varenhanceImageTool=client.AsEnhanceImageTool();vargetImageStatusTool=client.AsGetImageStatusTool();vardownloadImageResultTool=client.AsDownloadImageResultTool();vargetVideoStatusTool=client.AsGetVideoStatusTool();// Wire them up to an IChatClient:// ```csharp// var options = new ChatOptions// {// Tools = [enhanceImageTool, getImageStatusTool, downloadImageResultTool, getVideoStatusTool],// };// ```