PMVis

January 26, 2026 ยท View on GitHub

This repository contains the code implementation for the paper "Towards Reliable Agent-based Progressive Text-to-Visualization Translation with Explicit Interaction and Verification Rules".

๐Ÿ—๏ธ System Architecture

System Architecture

Core Components

ComponentFileDescription
User Agentagents/user_agent.pySimulates user multi-turn questioning behavior
System Agentagents/system_agent.pyLLM-based VQL generation
Clarification Agentagents/react_clarification_agent.pyReAct-based VQL clarification and quality assurance
Interaction Manageragents/interaction_manager.pyCoordinates the three-agent interaction loop
Tool Manageragents/clarification_tools_v2.pyClarification toolset management

๐Ÿ› ๏ธ Clarification Toolset

The Clarification Agent includes four built-in verification tools:

Tool NameFunction
sql_executorChecks the executability of the SQL portion in VQL on the database
syntax_checkerValidates VQL syntax correctness and compliance
schema_validatorVerifies that table and column names exist in the database schema
intent_matcherClarifies user's true intent and double-checks the correctness of generated VQL

๐Ÿ“ Project Structure

PMVis/
โ”œโ”€โ”€ agents/                          # Agent modules
โ”‚   โ”œโ”€โ”€ __init__.py                  # Module initialization
โ”‚   โ”œโ”€โ”€ user_agent.py                # User Agent
โ”‚   โ”œโ”€โ”€ system_agent.py              # System Agent
โ”‚   โ”œโ”€โ”€ react_clarification_agent.py # ReAct Clarification Agent
โ”‚   โ”œโ”€โ”€ interaction_manager.py       # Interaction Manager
โ”‚   โ””โ”€โ”€ clarification_tools_v2.py    # Clarification toolset
โ”œโ”€โ”€ eval/                            # Evaluation modules
โ”‚   โ”œโ”€โ”€ gemini/                      # Gemini model evaluation
โ”‚   โ”œโ”€โ”€ gpt-4o-mini/                 # GPT-4o-mini model evaluation
โ”‚   โ”œโ”€โ”€ qwen/                        # Qwen model evaluation
โ”‚   โ””โ”€โ”€ user_study/                  # User study evaluation
โ”œโ”€โ”€ main.py                          # Sequential main program
โ”œโ”€โ”€ main_parallel.py                 # Parallel main program
โ”œโ”€โ”€ parallel_config.py               # Parallel configuration
โ”œโ”€โ”€ util.py                          # Utility functions
โ”œโ”€โ”€ logger_config.py                 # Logger configuration
โ”œโ”€โ”€ logger_config_parallel.py        # Parallel logger configuration
โ”œโ”€โ”€ dataset.py                       # Dataset processing

๐Ÿš€ Quick Start

Requirements

  • Python 3.10
  • Dependencies: openai, pandas, psutil, sqlite3, nltk, tqdm

Install Dependencies

pip install openai pandas nltk tqdm psutil

Configure API Keys

Create a config.py file and configure your API keys:

# API Configuration

# OpenAI API Configuration
OPENAI_BASE_URL = 'your_openai_base_url'
OPENAI_API_KEY = 'your_openai_api_key'

# Qwen API Configuration (Alibaba Cloud)
QWEN_BASE_URL = 'your_qwen_api_url'
QWEN_API_KEY = 'your_qwen_api_key'

# Default Model Configuration
DEFAULT_MODEL = 'qwen-plus'  # Options: 'gpt-4o-mini', 'gemini-2.5-flash-lite', 'qwen-plus'

# Database Path Configuration
DATABASE_PATH = 'source_dataset/databases'

Run the Program

Sequential Execution

python main.py
python main_parallel.py

Configuration Options

You can adjust the following parameters in parallel_config.py:

# Processing Mode Configuration
MODE = "single_turn"          # "single_turn" or "multi_turn"
ENABLE_CLARIFICATION = True   # Enable/disable clarification feature

# Parallel Parameters Configuration
MANUAL_CONFIG = {
    'max_workers': 6,    # Number of parallel processes
    'max_items': 0,      # Maximum number of items to process (0 = all)
}

Results

Our main results of each LLM backbone in the paper can be found in eval/ folder.

๐Ÿ“ Logging System

The system provides detailed logging:

  • Sequential Mode: All logs output to console and a single log file
  • Parallel Mode: Each worker process has an independent log file for easier debugging

Log files are saved in the logs/ directory.