Skip to content

MEAI Tools

Example showing how to use Dataloop AIFunction tools with any Microsoft.Extensions.AI IChatClient.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Create an authenticated Dataloop client
using var client = new DataloopClient(apiKey);

// Create AIFunction tools for use with any IChatClient
var listProjectsTool = client.AsListProjectsTool();
var listDatasetsTool = client.AsListDatasetsTool();
var listTasksTool = client.AsListTasksTool();
var getItemTool = client.AsGetItemTool();

// Verify tools are created with correct metadata

// These tools can be passed to any IChatClient for function calling:
// var response = await chatClient.GetResponseAsync(
//     "List my Dataloop projects",
//     new() { Tools = [listProjectsTool, listDatasetsTool] });