Skip to content

MeaiTools

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

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

using var client = new EdenAIClient(apiKey);

// Create tools for chat, translation, image generation, summarization,
// sentiment analysis, and language detection.
var chatTool = client.AsChatTool();
var translateTool = client.AsTranslateTool();
var generateImageTool = client.AsGenerateImageTool();
var summarizeTool = client.AsSummarizeTool();
var sentimentTool = client.AsSentimentAnalysisTool();
var detectLanguageTool = client.AsDetectLanguageTool();

// These tools can be passed to any IChatClient that supports function calling.
var tools = new[] { chatTool, translateTool, generateImageTool, summarizeTool, sentimentTool, detectLanguageTool };