AVA ChartGenie LogoAVA, AI-Native Visual Analytics
AVA Logo

AVA

AI-Native Visual Analytics

A technology framework designed for more convenient visual analytics, powered by AI

💬

Natural Language

Ask questions about your data in plain English

🤖

LLM-Powered

Leverages large language models for intelligent analysis

Smart Processing

Auto-switches between in-memory and SQLite based on data size

📦Installation

Install AVA using your preferred package manager:

# npm
npm install @antv/ava
# yarn
yarn add @antv/ava

🚀Quick Start

Get started with AVA in just a few lines of code:

import { AVA } from '@antv/ava';

// Initialize with LLM config
const ava = new AVA({
  llm: {
    model: 'ling-1t',
    apiKey: 'YOUR_API_KEY',
    baseURL: 'LLM_BASE_URL',
  },
  sqlThreshold: 1024 * 1024 * 2, // 2MB threshold
});

// Load data
await ava.loadObject([
  { city: 'Hangzhou', gdp: 18753 },
  { city: 'Shanghai', gdp: 43214 }
]);

// Ask questions
const result = await ava.analysis(
  'What is the average GDP?'
);
console.log(result.text);
// Optionally access: result.code, result.sql, 
// or result.visualizationHTML

// Clean up
ava.dispose();

🏗️Architecture

AVA uses a modular pipeline architecture:

1
Data Module
Load from CSV, JSON, URL, or text
2
Metadata Extract
Type inference and statistics
3
Size Check
<10MB: JavaScript | ≥10MB: SQLite
4
Analysis Module
Generate & execute code/SQL
5
LLM Summary
Natural language response

📚API Reference

Constructor

new AVA(options: AVAOptions)
llm— LLM configuration (model, apiKey, baseURL)
sqlThreshold— Size threshold for SQLite (default: 10MB)

Data Loading

loadCSV(content: string)

Load data from CSV string

loadObject(data: object[])

Load data from array of objects

loadURL(url: string, transform?: Function)

Load data from URL

loadText(text: string)

Extract data from unstructured text

Analysis

analysis(query: string)

Analyze data with natural language query

Returns object with:
text — Natural language summary of the analysis
code — JavaScript code used (if applicable)
sql — SQL query used (if applicable)
visualizationHTML — Interactive chart HTML (if applicable)

💡Usage Examples

Browser File Upload

const fileInput = document.querySelector('input[type="file"]');
fileInput.addEventListener('change', async (e) => {
  const file = e.target.files[0];
  const content = await file.text();
  await ava.loadCSV(content);
  const result = await ava.analysis('Show trends');
});

API Data Analysis

await ava.loadURL(
  'https://api.example.com/sales',
  (response) => response.data.items
);
const result = await ava.analysis('Compare by region');

⚙️Configuration

AVA supports multiple LLM providers:

OpenAI
model: 'gpt-4'
baseURL: 'api.openai.com/v1'
Custom Provider
model: 'ling-1t'
baseURL: 'your-llm-api.com'

Best Practices

Always call ava.dispose() when done to free resources
Wrap async calls in try-catch blocks for error handling
Validate data format before loading
Set sqlThreshold based on expected data sizes
Never expose API keys in client-side code

Resources