Skip to content

Chat

Shows how to send a chat message to an AI provider via EdenAI.

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
using var client = new EdenAIClient(apiKey);

// Send a chat message through the EdenAI unified API,
// specifying one or more providers to route the request to.
var response = await client.Chat.TextTextChatCreateAsync(
    request: new TextchatChatRequest
    {
        Providers = ["openai"],
        Text = "What is the capital of France?",
        ChatbotGlobalAction = "You are a helpful geography assistant.",
        MaxTokens = 100,
    });