This example assumes using ModernMT; is in scope and apiKey contains your ModernMT API key.
1 2 3 4 5 6 7 8 9101112131415
varapiKey=Environment.GetEnvironmentVariable("MODERNMT_API_KEY")is{Length:>0}value?value:thrownewAssertInconclusiveException("MODERNMT_API_KEY environment variable is not found.");usingvarclient=newModernMTClient(apiKey);// Create AIFunction tools for translation.vartranslateTool=client.AsTranslateTool();varlistLanguagesTool=client.AsListLanguagesTool();varlistMemoriesTool=client.AsListMemoriesTool();vardetectLanguageTool=client.AsDetectLanguageTool();