Skip to main content
Complete type definitions for the Graphy AI SDK.

GraphConfig

The chart configuration object. See Graph Config Schema for the complete reference.
import type { GraphConfig } from '@graphysdk/core';

GenerateGraphParams

Request parameters for the Chart Maker Agent.
interface GenerateGraphParams {
  config: GraphConfig;
  userPrompt: string;
  metadata?: Metadata;
}
FieldTypeRequiredDescription
configGraphConfigYesThe current chart configuration
userPromptstringYesNatural language instruction
metadataMetadataNoRequest tracking information

GenerateGraphResponse

Response from the Chart Maker Agent.
interface GenerateGraphResponse {
  config: GraphConfig;
  response: {
    message: string;
    steps?: string[];
  };
}
FieldTypeDescription
configGraphConfigUpdated chart configuration
response.messagestringExplanation of changes made
response.stepsstring[]Optional breakdown of modifications

Metadata

Optional tracking information for requests.
interface Metadata {
  callId?: string;
  locale?: string;
}
FieldTypeDescription
callIdstringUnique identifier for tracking and debugging
localestringLocale for responses (e.g., en-US, fr-FR)

SSE Events

ProgressEvent

interface ProgressEvent {
  type: 'progress';
  percentage: number;
  message?: string;
  metadata?: Record<string, unknown>;
}

CompleteEvent

interface CompleteEvent<T> {
  type: 'complete';
  data: T;
}

ErrorEvent

interface ErrorEvent {
  type: 'error';
  error: string;
  code?: string;
  retryable?: boolean;
}

SSEEvent Union

type SSEEvent<T> = ProgressEvent | CompleteEvent<T> | ErrorEvent;

Configuration Types

ClientConfig

interface ClientConfig {
  apiKey: string;
  baseUrl: string;
  timeout?: number;
  retryConfig?: RetryConfig;
  logger?: Logger;
}

RetryConfig

interface RetryConfig {
  attempts: number;
  delay: number;
  backoff: number;
}
Defaults:
{
  attempts: 3,
  delay: 1000,
  backoff: 2
}

Logger

interface Logger {
  log: (...args: unknown[]) => void;
  warn: (...args: unknown[]) => void;
  error: (...args: unknown[]) => void;
  debug: (...args: unknown[]) => void;
}

AiChartType

Supported chart types for AI operations.
type AiChartType =
  | 'line'
  | 'bar'
  | 'groupedBar'
  | 'stackedBar'
  | '100StackedBar'
  | 'column'
  | 'groupedColumn'
  | 'stackedColumn'
  | '100StackedColumn'
  | 'combo'
  | 'pie'
  | 'donut'
  | 'funnel'
  | 'heatmap'
  | 'scatter'
  | 'waterfall'
  | 'table';
TypeDescription
lineLine chart
barHorizontal bar chart
groupedBarGrouped horizontal bars
stackedBarStacked horizontal bars
100StackedBar100% stacked horizontal bars
columnVertical column chart
groupedColumnGrouped vertical columns
stackedColumnStacked vertical columns
100StackedColumn100% stacked vertical columns
comboCombined line and column
piePie chart
donutDonut chart
funnelFunnel chart
heatmapHeatmap
scatterScatter plot
waterfallWaterfall chart
tableData table

Zod Schemas

The SDK exports Zod schemas for runtime validation:
import {
  AiChartTypeEnum,
  GenerateGraphResponseSchema,
} from '@graphysdk/ai';

// Validate a response
const validated = GenerateGraphResponseSchema.parse(response);