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: 'line',
data: {
columns: [
{ key: 'month', label: 'Month' },
{ key: 'users', label: 'Active Users' },
],
rows: [
{ month: 'Jan', users: 1200 },
{ month: 'Feb', users: 1800 },
{ month: 'Mar', users: 3100 },
],
},
};
const result = await ai.generateNarrative({
config,
userPrompt: 'Write a punchy title and a one-line caption',
});
// Narrative is embedded in the config content as TipTap JSON
console.log(result.config.content?.title);
console.log(result.config.content?.caption);