import { GraphyAiSdk } from '@graphysdk/agents-sdk';
import type { GraphConfig } from '@graphysdk/core';
const ai = new GraphyAiSdk({
apiKey: process.env.GRAPHY_API_KEY,
baseUrl: 'https://agents.graphy.dev',
});
const config: GraphConfig = {
type: 'column',
data: {
columns: [
{ key: 'region', label: 'Region' },
{ key: 'sales', label: 'Sales' },
],
rows: [
{ region: 'North', sales: 100 },
{ region: 'South', sales: 80 },
{ region: 'North', sales: 120 },
{ region: 'South', sales: 95 },
],
},
};
const result = await ai.generateMutation({
config,
userPrompt: 'Total sales by region, sorted highest first',
});
console.log(result.config); // GraphConfig with the aggregated dataset
console.log(result.response.steps); // Ordered list of transformations applied